View Single Post
Old Feb 21st, 2008, 11:27 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: Help with a file

In C and C++, you can't assign an array to another array: you have to individually copy each element of the array from one to another. As a C-style string (which is what you're using) is simply an array of characters, you can't do this:
file_in_name = "test.txt";
Instead, you have to do this:
strncpy(file_in_name, "test.txt", 79);
You may have been confused because the first way of doing this is allowed when you declare the variable. It's a quirk of C - you can only do it then.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote