fgetc_fputc函数
来源:互联网 发布:excel数据有效性 编辑:程序博客网 时间:2024/06/05 20:31
#include <stdio.h> void fgetc_fputc(){ char c = 0; while(1){ //按返回键会返回值 返回键对应的值转换为数字为10 不再阻塞 //stdin内部应该维护了一个队列 存储输入的字符 fgetc每次从队列里面获取一个字符 如果没有获取到 则阻塞等待输入 // getchar(); 从队列获取多余的空格 c = fgetc(stdin); getchar(); //if((c >= 49)&&(c <= 58))//输入1-9并打印 printf("输入的数字是:%d \n",c) ; //fputc(c,stdout); if(c =='q') break;//q退出 // fclose(stdin);//不再阻塞 进入死循环 } return 0; } void read_text(){ FILE *f =fopen("fgetc_fputc函数.c","rb"); char c; if(f!=NULL){ //一个字符一个字符的读取 while((c=fgetc(f))!=EOF){ //把读取的字符输入到屏幕 fputc(c,stdout); } fprintf(stdout,"reading file finished\n"); fclose(f); fclose(stdout); }else{ printf("fail to open file"); } } int main(int argc, char *argv[]) { // fgetc_fputc(); read_text(); }
0 0
- fgetc_fputc函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- js执行顺序
- Docker镜像以及CMD与ENTRYPOINT指令的比较
- Atitit 编程语言知识点tech tree v2 attilax大总结
- 在MySQL中阻止UPDATE, DELETE 语句的执行,在没有添加WHERE条件
- (OK) Angular 2 CRUD, modals, animations, pagination, datetimepicker and much more
- fgetc_fputc函数
- 《甜蜜蜜》
- window下用taskkill杀死进程
- List<Map<String, String>> 合并map的字段数据问题
- Linux-Shell脚本执行方式
- 协议森林08 不放弃 (TCP协议与流通信)
- 算法:分治法求凸包上的点以及由凸包所构成的多边形的面积
- sqlalchemy 包实践小结
- kubernetes1.4 基础篇:Learn Kubernetes 1.4 by 6 steps(6):Step 5. Scale Your App