当前位置: 首页 > news >正文

网站落地页制作最简单的网站

网站落地页制作,最简单的网站,百度网址怎么写,云虚拟主机怎么做2个网站标准IO 头文件需求#xff1a; #include stdio.h1.fopen和fclose (1)fopen fopen的函数功能是打开一个文件。 首先看看fopen的函数声明#xff1a; FILE *fopen(const char *path, const char *mode);第一个参数path是文件地址#xff0c;传入的是不可变的字符…标准IO 头文件需求 #include stdio.h1.fopen和fclose (1)fopen fopen的函数功能是打开一个文件。 首先看看fopen的函数声明 FILE *fopen(const char *path, const char *mode);第一个参数path是文件地址传入的是不可变的字符串第二个参数是mode是指打开方式传入的也是不可变的字符串返回的是FILE指针。 mode的可选项主要有 r Open text file for reading. The stream is positioned at the beginning of the file. r Open for reading and writing. The stream is positioned at the beginning of the file. w Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. w Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file. a Open for appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file. a Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file. (2)fclose fclose的函数功能是关闭一个文件。 fclose的函数声明 int fclose(FILE *fp);传入的参数是FILE指针即fopen创建的那个指针成功则返回0否则返回EOF并将错误存储在errno中 附Linux中系统调用的错误都存储于 errno中errno由操作系统维护存储就近发生的错误即下一次的错误码会覆盖掉上一次的错误。 2.fgetc和fputc (1)fgetc fgetc的功能是从stream中读取下一个character。 函数声明如下 int fgetc(FILE *stream);传入的参数是stream来源即FILE指针。 (2)fputc fputc的功能是将一个character写入到stream中。 函数原型是 int fputc(int c, FILE *stream);第一个参数就是要写入的字符虽然是int型但是只用低八位unsigned char第二个参数即写入到的stream来源即FILE指针。 int main(int argc, char const *argv[]) {FILE *fp1 fopen(1.txt, r);FILE *fp2 fopen(2.txt, w);if(NULL fp1){fprintf(stderr, fp1 open error);}while(1){int a fgetc(fp1);if(EOF a){break;}fputc(a, fp2);}fclose(fp1);fclose(fp2);return 0; } 3.fgets和fputs (1)fgets fgets的功能是从stream中读取至多一定数量的字符并且存入buffer中遇到\n或者EOF就停止读取。 函数声明 char *fgets(char *s, int size, FILE *stream);第一个参数是字符串buffer指针传入的是char*这里当然是可变的第二个参数是至多读取的字符数传入的是int第三个参数就是stream来源即FILE指针。 这个函数把获取到的字符传入buffer后还会自动在末尾加上\0表示字符串的结束。 (2)fputs fputs的功能是将字符串s传到stream中。 函数声明是 int fputs(const char *s, FILE *stream);第一个参数是不可变的字符串第二个参数就是要写到的stream来源这里是FILE指针。 字符串被写入stream后还会自动在末尾加上\0表示结束。 (3)fgets与fputs综合运用复现copy int main(int argc, char const *argv[]) {FILE *fp1 fopen(5.txt, r);FILE *fp2 fopen(6.txt, w);if(NULL fp1 || NULL fp2){fprintf(stderr, fopen error);return 1;}while(1){char s[1024] {0};if(NULL fgets(s, sizeof(s), fp1)){break;}fputs(s, fp2);}return 0; } 但是该函数不能拷贝二进制类型文件。
http://www.pierceye.com/news/880313/

相关文章:

  • 广西城乡与住房建设厅网站房产网站栏目建设
  • 已收录的网站不好优化上海上市公司排名
  • 保定网站建设公司大全开发微信微网站建设
  • 微信扫码抢红包网站做渝网互联重庆网站制作
  • 用wordpress开发网站缪斯设计官网
  • 黄南州wap网站建设公司旅游类网站做百度竞价
  • 中国电力建设集团有限公司网站wordpress购买
  • 深圳工装公司网站优化顺义案例
  • 四川省工程建设信息官方网站个人域名注册免费
  • 网站建设用源码徐州金网网站建设
  • 老哥们给个关键词威海网站seo
  • 贵州网站备案延庆网站建设师
  • 做网站怎么上词网站建设战略伙伴
  • 绵阳网站推广排名给网站网站做代理
  • 网站轮播代码北京的公司有哪些
  • 网上书城网站开发外文参考文献wordpress禁用谷歌字体插件
  • 团购模板网站全网营销型网站建设模板
  • ac域名网站邯郸中国建设银行网站
  • 广州seo网站开发微信营销的优势
  • 宝塔可以做二级域名网站么有哪些好的做兼职网站
  • 网站建设公司落寞特殊符号网名生成器
  • 设计分享网站在闲鱼可以做网站吗
  • 安全等级保护每个网站必须做吗实惠的网站建设公司
  • vue可以做pc端网站山东专业企业网站建设
  • 推广网站软文高中网站制作
  • 做h的动漫在线观看网站安阳市有几个区几个县
  • 帝国cms地方门户网站模板怀集县住房和城乡规划建设网站
  • 河北住房建设厅网站首页怎么自己建设网站
  • 政务网站建设及安全下载app赚钱的平台
  • 如何制作一个论坛网站都江堰建设局网站