|
-
Jan 23rd, 2001, 10:32 PM
#1
Thread Starter
Frenzied Member
when I do this:
board[x][y]="";
i get this error:
error C2440: '=' : cannot convert from 'char [1]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
How do I correctly assign somethng to a string?
-
Jan 23rd, 2001, 11:03 PM
#2
New Member
You cant do it like that.
Here is the code:
strcpy(board[x][y], "");
hope that helps
-
Jan 24th, 2001, 01:22 PM
#3
Monday Morning Lunatic
What is the definition for the board?
You can't randomly copy things into a string, as you need to allocate a buffer first, since in C, strings are only arrays of single characters. You can use the string class from the STL, but for a lot of things it's just as easy to use the C-style methods.
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
|