View Single Post
Old 11-30-2012, 02:06 PM   #9
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: C++ fstream and arrays

Char by char would be really messy. Like I said, inputting strings would work best if you inputted the data like I showed (spaces and all). Here's an example of reading in strings from a text file and placing them into an array:

Code:
string array [size];
ifstream file;
file.open("name.txt");

while(!file.eof())
{
     string input;
     file>>input;
     array.push_back(input);
}
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote