-
why these errors?
this is in my timer...
PHP Code:
milli++;
if(milli>=10) {
milli=0;
secs++;
}
if(secs>=10) {
secs=0;
mins++;
}
char time;
char buffer[6];
strcat(time, itoa(mins, buffer, 6));
strcat(time, ":");
strcat(time, itoa(secs, buffer, 6));
strcat(time, ":");
strcat(time, itoa(milli, buffer, 6));
SendMessage(ghWnd_clock, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) time);
it basically is a stopwatch, but I get all these errors!
Code:
error C2664: 'strcat' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Windows\Desktop\C c++\Win32_clock\clock.cpp(108) : error C2664: 'strcat' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Windows\Desktop\C c++\Win32_clock\clock.cpp(109) : error C2664: 'strcat' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Windows\Desktop\C c++\Win32_clock\clock.cpp(110) : error C2664: 'strcat' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Windows\Desktop\C c++\Win32_clock\clock.cpp(111) : error C2664: 'strcat' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
(sorry I should have posted only 1 :p )
why doesn't this work...I did the itoa function :confused:
-
I didn't understand the msdn explanation of sprintf :(
-
It's basically printf, but uses a string instead. Actually, I wrote _snprintf, which has a length as well:
Code:
char pcBuf[100];
_snprintf(pcBuf, 100, "Number: %d", iNum);
-
Doesn't strcat() require a properlay allocated buffer?
-
That's what I thought, but all the docs are really vague about it so I always use _snprintf (actually I use _tsnprintf, but oh well :rolleyes:)