首页 > 编程知识 正文

c语言中fwrite函数的用法,fprintf函数的用法

时间:2023-05-03 12:20:36 阅读:156984 作者:2289

# include iostream # include string # include cstdio # includecstdlib # include string.husingnamespacestd; # definen 100类文件{ public : voidlodefile (conststringpath ); (; void file :3360 lo defile (conststringpath ) file * p=fopen (path.c _ str )、' rb '; if (! p ) exit(0; char str[N 1]; strcpy(str,path.c_str ) ); //printf(%s )、str ); //循环读取每行的shujuwhile(fgets ) str,n,p!=null}{coutstr'666'endl; printf('%s”,str; }printf(xx ); close(p ); }int main () { File file; file.lodefile ()/home/XL/demo/1.txt ); 打印(1111 ); 返回0; }运行结果

- virtualbox :~/demo/file $./fopen 12345 AAAA SD 66612345 AAAA SD其中的1.txt是已经创建的文件,在c中,由于没有fopen,因此path.c

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。