c++的库不经常使用。
使用C的方式是
FILE * fp = fopen("d:\\test","wb");
if(fp)
{
fprintf(fp,"%d\r\n",a);
fprintf(fp,"%d\r\n",b);
fprintf(fp,"%d\r\n",c);
fclose(fp);
}
c++读文件怎么换行?
假如一个文件内容是
1 2 3
4 5 6
7 8 9
怎么把1 4 7 读出来?
c++写文件怎么换行?
就是你先写了一串信息了然后你想之后写的东西可以跳到文件下一行记录
是直接用endl吗?
比如
fstream outfile;
outfile("d::\text",ios::out);
int a=1,b=2,c=3;
outfile<<a<<endl;
outfile<<b<<endl;
outfile<<c<<endl;这样吗?
验证码登录>
验证码登录>
自动登录 | 忘记密码?
密码登录>
自动登录