C语言程序创建文件
2015-10-16 10:44
387 查看
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
if((fp=fopen("g:\\a.txt","wb"))==NULL)
{
printf("\nopen file error");
getchar();
exit(1);
}
fputs("34234",fp);
fclose(fp);
if((fp=fopen("b.txt","wb"))==NULL)
{
printf("\nopen file error");
getchar();
exit(1);
}
fclose(fp);
return 0;
}
#include <stdlib.h>
int main()
{
FILE *fp;
if((fp=fopen("g:\\a.txt","wb"))==NULL)
{
printf("\nopen file error");
getchar();
exit(1);
}
fputs("34234",fp);
fclose(fp);
if((fp=fopen("b.txt","wb"))==NULL)
{
printf("\nopen file error");
getchar();
exit(1);
}
fclose(fp);
return 0;
}
相关文章推荐
- 剑指offer第十三题【调整数组顺序使奇数位于偶数前面】c++实现
- C++对象池完整实现
- 雪*C语言核心知识总结四
- [BFS] Zjut CPP 1907 破解迷宫
- C语言数组
- CString转double
- Effective modern C++ 条款 38:如果异步至关重要请指定std::launch::async
- Debug Assertion Failed! FILE viewform.cpp , line 69
- C++访问控制符private/protected/public
- VC++ 6.0 C8051F340 MFC programming note
- C++项目二(2):摄氏度的转换
- C++项目中的extern "C" {}
- C语言变长数组data[0]的用法
- C语言项目二:电阻并联
- C语言字节对齐问题详解(zz)
- C语言的指针的基本语法
- C语言的指针的基本语法
- C语言的指针的基本语法
- C语言的指针的基本语法
- C语言项目一:点阵图