|
-
March 3rd, 2005, 09:40 PM
#1
reading text files!
hi, currently i have no problem retrieving each line in the text file using the following code:
char buffer[256];
ifstream myList("List.txt");
if (! examplefile.is_open())
{ cout << "Error opening file"; exit (1); }
while (! myList.eof() )
{
myList.getline (buffer,100);
cout << buffer << endl;
}
However, im trying to abstract each value separated by a comma. heres an example of a line in the text file
"mr john", 42, 8, "likes banana", true
"miss john", 40, 0, "likes papaya", false
i would like to do something tp retrieve the values and store them like this...
Name = mr john;
age = 42;
workingHrs = 8;
f_food = "likes banana;
active = true;
thanks in advance.
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
|