samedi 21 février 2015

Printing out strings from a file after newline

I'm trying to output contents of my text file as strings to the console but I am not getting the desired output. I tried implementing the following but still no luck, any help would be appreciated.



int main() {
ifstream inFile("src/text.rtf");
string line;

while (getline(inFile, line)) {
cout << line << endl;
}
return 0;
}

Text contents:
1
2
3
4
5
6

Output:

{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\ tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 1\
2\
3\
4\
5\
6}

Aucun commentaire:

Enregistrer un commentaire