mardi 24 mai 2016

How to ignore enter key in file handling i c++

Is there any way to skip enter key while reading a text file. for example. lets i have two text file input.text and output.text my input.text text file look like welcome to stackoverflow(press enter key and start new line) another sentence . . .

i read first line from input.text file and some part of line write to output.text file. but when i read the second line after enter key my first line get lost in text file. what should i do? to read file i use ifstream input.open("input.text"); while(input) { getline(input,string); }

and to write

ofstream output; output<<string;

Aucun commentaire:

Enregistrer un commentaire