|
wait, you want to merge 2 ints into a double, or split a double into 2 ints ?
BTW be careful, sizeof(int) == 4 only on 32 bits plateforms !
|
|
|
|
|
|
int main(int argc, char* argv[])
{
__int32 i[2];
i[0] = 1000;
i[1] = 2000;
double d = 0;
d = *(double*)&i[0];
printf("%f\n", d);
__int32 *o;
o = (__int32*)&d;
printf("%d %d\n", o[0], o[1]);
return 0;
}
of course, anyone doing something like this would end up in the Daily WTF, for sure.
|
|
|
|
|
I'll test this & tell you. Thanks. BRB
|
|
|
|
|
Chris, that worked thanks. Now I'm happy I have a way. But if you can still get me a way that will never take part in WTFs that'd be excellent.
|
|
|
|
|
Is this what you are after:
int int
/-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-\
| | | | | | | | | | | | | | | | |
\-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-/
double
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
lol, David, are you moking at newbies ?
|
|
|
|
|
Moking? Do you mean mocking? No, I was just trying to clarify what the intent was by using a visual.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Moking? Do you mean mocking?
indeed i was.
but that's true also that pictures are more clear than words sometimes...
|
|
|
|
|
|
Hello members,
I have a VC++ 6 dialog based application as a stand alone exe which is called from a batch or a script file. How can I change the return code of my application to the operating system after closing my application? I want to check in the batch or script file, if the application worked fine or if an error has occured.
Hope anyone can help me.
Thanks
Juergen
|
|
|
|
|
your main() function must not be void if you want to return a value.
only then, you return the value you like, and knowing the meaning in the batch script, you can then catch it and test it...
|
|
|
|
|
Hello TOXCCT,
I do not a have a main(). I do have a WinMain() and this is somewhere in the installation directory of Visual C++ (I think in WinBase.h). This file is not (directly) part of my project.
|
|
|
|
|
oh sorry, dialog based project, i read console project...
anyway, if you use MFC, check the value returned by the InitInstance() method of your project.
|
|
|
|
|
Is there no function or message which can be used for setting the exit code of an application?
|
|
|
|
|
|
Return whatever value you want from CWinApp:ExitInstance() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi David,
thanks a lot. Exactly what I was looking for.
|
|
|
|
|
Hi guys,
writing a driver for a network interface, i'm faced with setting the QoS (Quality of Service) for each IP packet depending of the type of data being transmitted. now, we can transmit anything over the network: data, voice, video.. each of them must have its own QoS.
looking at data header from the data stream being passed to the driver could be a way but i'm wondering if it's really down that route, as there could be so many headers for different file formats.
any idea on how to determine the type of data being passed?
Thanks,
Fred
|
|
|
|
|
i am using the PlaySound function -Platform SDK: Windows Multimedia- to play .wav files, the problem is i need to know when this function finish playing the sound file and F.Y.I. when (fdwSound) parameter is set to SND_ASYNC "asynchronously", the function return immediately after beginning the sound.
also when (fdwSound) parameter is set to SND_SYNC "Synchronous", the function wait till it end the file playing and then return
i want to know :
1 - when the function finished playing the file if the (fdwSound)param. is SND_ASYNC
2 - OR how can i stop playing the file if the (fdwSound)param. is SND_SYNC
thnx alot 4 ur time and concern !!
it is good to be here
|
|
|
|
|
Well, you could use PlaySound from a secondary thread, running synchronously then posting a thread message when it completes.
Steve S
Developer for hire
|
|
|
|
|
that's not wat i want
i want if it si running synchronously ---> to be able to stop the file playing
OR if it is running asynchronously ---> to detremine when the file finish playing
that's it;)
i already able to know that the file finish playing when it is synchronously called cuz the function doesn't return untill it finish playing
|
|
|
|
|
|
You want to be able to play it synchronously, yet be able to stop it playing.
Can't do that, because PlaySound won't return until it's already finished.
You want to play it asynchronously, and get notified when it's stopped playing.
Can't do that, because PlaySound provides no notifications.
However, if you read what I wrote, you can get the behaviours that you want.
Spin another thread to call PlaySound synchronously. That thread can tell you when it's finished, and the effect on the other thread is that of playing it asynchronously.
If you want to stop it playing, you can call playsound with a purge option (as someone else has suggested) from the original thread, which will give you what you want.
Alternatively, you can try the MCI interface, or look at the waveOut* functions. However, using waveOut is a lot more complicated than using PlaySound with a second thread
There's a phrase which comes to mind: If you won't like the answer, don't ask the question...
Steve S
Developer for hire
|
|
|
|
|
singersinger wrote: OR how can i stop playing the file if the (fdwSound)param. is SND_SYNC
PlaySound(NULL, 0, SND_PURGE) might do the trick if called from another thread.
We're the regulators that de-regulate
We're the animators that de-animate
Fold with us! ¤ flickr
|
|
|
|