a line from a text file is
"mere thinking is nothing" 50
now is there any function by which i can save the contents from the line between the two quotes only into a character array variable
a line from a text file is
"mere thinking is nothing" 50
now is there any function by which i can save the contents from the line between the two quotes only into a character array variable
Use the ignore functonality to skip the first quotation mark, then read in the string using the getline function while specifying the quotation mark as the delimiter.
DavidCode:#include <iostream> #include <fstream> using namespace std; int main() { ifstream inText("message.txt", ios::in); char message[50] = {'\0'}; inText.ignore(1); inText.getline(message,50,'"'); inText.close(); cout << message << endl; return 0; }
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the Land of Mordor where the Shadows lie.