No. The file was opend in text(translated) mode
and '\r' will be automatically added if only '\n'
is used. And it is more compatible to use only '\n'
for other systems because unix doesn't want '\r' for
a text file.
Hee S. Chung
heesc@netian.com
I have had problems with it in notepad. Just looks like a black bar. All other programs such as word and word pad look fine. Notepad is the only place I have found a problem.
I think there is no problem when "wt" is specified
for fopen and the created program is executed on
DOS or Windows. Because line end character is
translated properly for each platforms when
text(translated) mode is used.
I tested notepad and there was no problem. Ultra
editor says the saved 'test.txt' is DOS format text
file. If "wb" is specified in my code instead of "wt"
, the saved file will be Unix format text.
Hee S. Chung
heesc@netian.com
see in C++ woking with files is much more simplier:
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
char* x[100];
int c;
ofsrteam xx("xx.txt"//same as fopen with w
xx<<"hello world"<<endl;
xx<<"1 hello world"<<endl;
xx<<"2 hello world"<<endl;
xx.close();
ifstream yy("xx.txt"//same as fopen with r
yy>>x;
cout<<x<<" "<<endl;
yy>>x;
cout<<x<<endl;
yy>>c;
yy.getline(x,100);
cout<<c<<" "<<x<<endl;
return 0;
} John Fill
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.