|
-
Apr 30th, 2001, 06:17 PM
#1
Thread Starter
Frenzied Member
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 )
why doesn't this work...I did the itoa function
-
May 1st, 2001, 04:10 PM
#2
Thread Starter
Frenzied Member
I didn't understand the msdn explanation of sprintf
-
May 1st, 2001, 04:16 PM
#3
Monday Morning Lunatic
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);
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 1st, 2001, 04:47 PM
#4
Frenzied Member
Doesn't strcat() require a properlay allocated buffer?
Harry.
"From one thing, know ten thousand things."
-
May 1st, 2001, 04:50 PM
#5
Monday Morning Lunatic
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 )
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|