Hello. I need your help on placing std strings into array.
I used the following in declaring array of string but none of them seem to work. I have 10 std strings and I want to put them in an array.
Also how do I go back, or read in a part in file after the while statement below. Because when I try to read in a line after the while statement, it doesn't read in anything ( I think it has already reached the end of file) but I need to get access to that part of the file.Code:string mystringcollection[10]; //I don't know which of the following char *mystringcollection[10]; //is the correct declaration
Thanks in advance for your suggestion/help.Code:while (getline(infile,line)) { //get next line of input file //search for something in file and do something } //go back to next part of file getline(infile, line); outfile<<line; //outputs nothing




Reply With Quote