I have to copy words in from a text file into a array i used a code that looks like this. My code errors I was hoping one of you could tell me what i am doing wrong.
up top i used this to declair my stuff
-------------------------------------------
string one,two,three,four,five;
string words[6];
-------------------------------------------
this part of my code i was trying to copy in the string
I have to read 5 words from a text file and place the words back into an array.
So i have a text file named words.txt with 5 words in the file
I have to take the words and place them in the words[] array in slots 0 to 4 and then print them on the screen. The page you linked doesn't help me and the code you placed doesn't help either.
That is the prototype for strcpy(). Notice that it takes two pointers to chars, but that you're passing it two std::strings.
std::strings have the assignment operator overloaded to make things easier.