|
Thanks bro, i'm really serious :->... my friend actually ask me that a while ago. I'm digging in directx programming so i don't have time to recall. It's great coz i've learned itoa. Thanks..
"You have to be in a situation where you see just how fast things fail to make you take it seriously, I guess. " Bruce Eckel
|
|
|
|
|
Kuroro Rucilful wrote: hanks bro, i'm really serious :->... my friend actually ask me that a while ago. I'm digging in directx programming so i don't have time to recall. It's great coz i've learned itoa. Thanks..
if Looking for Runtime Function then you can try _ttoi or _itot function
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
don't you know that char is also an integral type ?
you can simply do this :
int i = 2;
char c = i;
but maybe what you meant wasn't that but "converstion from int to C-Style strings" !?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
See maybe it is some helpful to you
<code>
CString str;
TCHAR lpc[20];
TCHAR Buffer[20];
lpc[0]='\0';
(1) str.Format("%d",123);
(2) wsprintf(lpc,"%d",456);
(3) itoa(789,Buffer,10);
whitesky
|
|
|
|
|
I make a win32 program which use createthread function,the code:
header file "vfw_receiver_July_18Dlg.h"
DWORD WINAPI sock_thread( LPVOID pParam );
the header file <windows.h> is already included.
source file "vfw_receiver_July_18Dlg.cpp"
DWORD WINAPI CVfw_receiver_July_18Dlg::sock_thread(LPVOID pParam)
{
...
}
void CVfw_receiver_July_18Dlg::OnButtonStare()
{
...
DWORD Dummy;
HANDLE h=CreateThread(NULL,NULL,sock_thread,NULL,NULL,&Dummy);
}
When I compiled the source file, it throws a error says :"
error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'
anything wrong with my code? please give me some advice , thanks in advance.
|
|
|
|
|
The CreateThread takes a pointer to a global (non-member or static member) function, not a pointer to a member function.
You'll have to do something like this:
class CVfw_receiver_July_18Dlg : ...
{
void OnButtonStare()
{
DWORD dwThreadId;
HANDLE h = CreateThread(
NULL,
0,
&CVfw_receiver_July_18Dlg::RawThreadProc,
this,
0,
&dwThreadId
);
if (h)
{
CloseHandle(h);
}
}
DWORD ThreadProc()
{
}
static DWORD WINAPI RawThreadProc(LPVOID lpParameter)
{
CVfw_receiver_July_18Dlg *pThis = static_cast<CVfw_receiver_July_18Dlg *>(lpParameter);
return pThis->ThreadProc();
}
};
Steve
PS: Unless you know what you're doing you shoudn't use CreateThread . Use beginthread or beginthreadex instead.
|
|
|
|
|
Stephen Hewitt wrote: PS: Unless you know what you're doing you shoudn't use CreateThread. Use beginthread or beginthreadex instead.
That's a great way to state that. Of course as soon as someone a:-Dsks why the fun begins.
Also not a great idea to send a UI based class as the LPARAM to a Thread Proc unless you know what you are doing. I would even argue that it is not a good design even if you do know what you are doing.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
led mike wrote: Also not a great idea to send a UI based class as the LPARAM to a Thread Proc
Passing a pointer to the class in question in the LPARAM is a common technique to get a member function to run in another thread - It's standard practice. I would argue that multi-threading is not a good idea at all unless you know what you're doing however.
Steve
|
|
|
|
|
Sure... which is why a UI class event handler method should not be starting a thread, from a design standpoint.
Stephen Hewitt wrote: I would argue that multi-threading is not a good idea at all unless you know what you're doing however.
Spot on!
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Thanks to Steve and Mike very much. I have settled it out according to your help.
Regards!
Robert
|
|
|
|
|
Sir,
Do you know something about usbzip32 or usbzip63 boot?
Such as mainboard setting and the file system(Fat16/Fat32) of my usb mass storage device?
Does the disksize of usbzip32 boot device must less than 2GByte?
And i like to discuss this topic with you by msn;player_game04@hotmail.com
Thanks a lot!
momer
All the blesses we enjoy are the fruits of labor,toil,study and self-denail.
All the blesses we enjoy are the fruits of labor,toil,study and self-denail.
|
|
|
|
|
I downloaded the latest copy and ran the vcvars32.bat. Then I ran nmake to build the boost libraries. All worked fine. Next I tried a simple test app to experiment with boost regex. The app will not complie and there is an error message: 'BOOST_REGEX_VC6_MDID.DLL' missing.
In the settings for C++ -> Reprocessor I added the path to "Additional Library Paths" I also set the library path for the Link -> Input setting.
How can I tell if the VS6 environment paths are set correctly and that the proper include and lib paths are set?
Mark
|
|
|
|
|
Have you built Boost. Most of Boost is simple header files and doesn't need building but the more complicated libraries such as Boost.Regex need to be built. You will have to mess around with "bjam".
Steve
|
|
|
|
|
I followed the instructions in this article:
Adding Regular Expressions to Your App with Regex++
I believe that the RegEx download from Dr. John Maddock's site has already been built using bjam.
When I tried compiling the demo app that the CP article lists the system returns the missing DLL error message.
Mark
|
|
|
|
|
Mark F. wrote: I believe that the RegEx download from Dr. John Maddock's site has already been built using bjam.
My comments were on Boost; I'm not sure what the deal is if you download RegEx separately. Still though, Regex uses STL and is packaged in .lib files (part of it anwyay). It uses the STL that your compiler uses. Given that the C++ ODR (One Definition Rule) states that all definitions of a class must be consistent in all compilation units this implies that you'll have to build RegEx using your compiler's libraries to ensure this consistency. Perhaps it has already been pre-built for a number of popular compilers, but I doubt it. Also if you've modified your STL, by installing the Dinkum VC6 STL fixes for example, you'll have to rebuild it.
Steve
|
|
|
|
|
NICE POST! [twothumbsup]
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Where do i start when figuring out an error LNK2019: unresolved external symbol ?
I defined a function that returns a map
std::map<int, const="" char="" *=""> getMyMap
Whenever i try to call this function, getMyMap, i get the error.
|
|
|
|
|
LCI wrote: Where do i start when figuring out an error LNK2019: unresolved external symbol ? MSDN...?
It seems that the definition of getMyMap can't be found, if it's in another file make sure that you are linking with it.
|
|
|
|
|
It is all in the same class..
The definition was made in the .h file and the function is in the .cpp and it is also being called from there...
|
|
|
|
|
Found the problem.. it was my fault.
The defintion in the .cpp was without the class identifier.
Silly me...
Sorry
|
|
|
|
|
well... don't know what to say
|
|
|
|
|
Newbie question here. I have a bunch of text that I want to write both to the stdout and to a logfile using fprintf. Currently, I'm using the primitive method of just printing out everything twice, once to the stdout and once to the logfile. I thought about an elegant way of doing this, and the best I could come up with is to overload fprintf so it'll take two FILE* arguments, like fprintf(stdout, logfile "text %d", x, ...) etc. While trying to overload fprintf, however, I ran into difficulties since it takes a variable argument list and the overloading seems to be a lot more complicated. I played around with va_list, va_arg and such but ended up getting nowhere.
Is there an easy way of doing this, or can anyone offer some assistance in coding this up?
Thanks a lot in advance.
|
|
|
|
|
look at vfprintf(...) it takes a va_list
|
|
|
|
|
Have you considered:
void MyPrintf( const char *pFormat, ... )
{
va_list marker;
va_start(marker, pFormat);
vprintf(pFormat, marker);
vfprintf(stderr, pFormat, marker);
va_end(marker);
}
void main( void )
{
MyPrintf("%s\n", "Hello World");
MyPrintf("%d\n", 123);
}
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there any way to get a signal from the PC to my application when a USB device is added or removed from the PC. I have a USB chip (CP2102 from Silicon Laboratories), and I am currently polling every second and looking to see if it is still in the registry or not.
There must be any easier way to detect a USB connection or disconnection in C or C++. Is there anyway to ask Windows to send me a message or an event?
|
|
|
|