|
I was afraid that was the only way.
|
|
|
|
|
Doing anything much in any thread except the main one which has anything remotely to do with CWnd* and/or MFC Handle Maps is a real pain in the backside. I go through various hoops in ED to work-around these limitations.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hexadecimal data are stored in a string(CString type).How can I
convert them to a Hexadecimal value?
LeonOrient
|
|
|
|
|
Use the CString.GetBuffer(CString.GetLength()) function to get the buffer of the CString and then use
unsigned long strtoul( const char *nptr, char **endptr, int base ); to convert the string to an unsigned long. After this, call CString.ReleaseBuffer().
The base for the strtoul function would in your case be 16.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
This is a difficult way. At first I think as you. But after a moment
I think that since this is a frequent convertion, so the Micro Soft
should offer a function to solve the problem.
What is the function? Can you tell me?
LeonOrient
|
|
|
|
|
A difficult way? 3 lines? 2 lines for preparing the CString and only 1 line to do the conversion? Not that much I would say...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
----------------------------------------------------------------------------
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
Could you tell me what the codes above can do with?
LeonOrient
|
|
|
|
|
Yes, I could. Have you tried it?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
No, but I haver tried another way, it's very easy. Please look!
strText=m_lstWrite.GetItemText(i,j+1); //Get the CString: strText
sscanf((const char*)(strText),"%x",&temp); //convert,Only a sentence!
Of course, It's very nice to discuss with you.
LeonOrient
|
|
|
|
|
Well! BUT you use a const char * cast to get the char* from the CString. My solution with GetBuffer/ReleaseBuffer is safer.
If I would do it with a cast like you my solution would be:
strText = m_lstWrite.GetItemText(i,j+1);
temp = strtoul((const char*)(strText),NULL,16); Only one line of conversation code then too!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
My god!
It is very good and very easy!
And it's also very regretful for me to say that and not to read MSDN carefullly after you gave me the tip.
Thank you very much!
LeonOrient
|
|
|
|
|
A frequent conversion?
not for me... it's rare that I want to convert a string into a hex string of individual bytes. If I was writing hex dump programs, it might be.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
I should use "not very easy" to replace "difficult".
Sure, it is a good way to solve the problem.
In addition, maybe we will program simply to find the endptr's value, do you think so? ( I am not good at using the function yet, maybe i am wrong again.)
Could you give us an example, please?
LeonOrient
|
|
|
|
|
Just use NULL for endptr
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
;PProblem: Convert CStrring to int. etc
We can use the function: atoi,atof,atol etc
LeonOrient
|
|
|
|
|
As far as I know atoi, atof and atol cannot read Hex strings
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
int n;
sscanf((const char*)(yourString),"%x",&n);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This is a good thought!
All is right!!
3Ks!
LeonOrient
|
|
|
|
|
I want to know if you could create a real life world inside C++? Because I have had a really crazy idea.. now I know it may seem really stupid but think about the possiblities if you could do it. That is why I am trying to find some people to help me in the creation of a world that you would be able to enter through VR. Yes, if you are asking it is sort of like the matrix. However, you will be able to access it through a VR helmet or something of that nature however, that is beside the point. Firstly, I just want to know if it is possible. So please help me.
"Life is a game that can't be won..."
|
|
|
|
|
What have you been smoking and where can I get some?
|
|
|
|
|
|
Theoretically possible, practically not (or do you have a 1000000-PetaHz processor and 10000000 PetaBytes RAM)?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
a. "Real life" is always (*always*) != "Simulations of RL" and will *always* be no matter how 'sophisticated' they are made.
b. Computers can only (*only*) handle simulations and that's always TRUE to all time.
Therefore what you are asking is impossible.
Regards,
Michael Mogensen, mm it-consult dk.
|
|
|
|
|
What makes you so sure that we aren't living in the matrix?
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
I suggest that VRML might be a start. You can write your worlds as text files, which gets processed by a VRML engine to create the world that could be viewed through a VR helmet or just on screen.
Elaborate and interactive worlds can be created without using any C++ programming. Scripts can also be run enabling the author to create movement of objects within the world independant of the viewer.
I would suggest doing a search for some VRML worlds on the internet.
In programming terms, the ParallelGraphics VRML Cortona engine has some neat COM interfaces which allows the inclusion of 3D worlds in your own programs and 3d interaction ( see www.parallegraphics.com)
Processing speed is a real problem though. The more real the simulation, the bigger the volume of data to process which takes longer and longer to update. Currently, PCs do not have enough grunt to produce a real real world. To produce realistic animated faces etc as well all the usual viewer parallelaxes etc will kill most PCs for a long time in the future (but I would like to be wrong).
Using VRML, you can only produce simple dynamic and interactive worlds. Most authors use it model sophisticated shapes rather than whole worlds. If you want something more complicated, I guess that you would have to resort to using the imagination, as we currently do.
MA
|
|
|
|