2020年1月19日

关于文件行读取

摘要: FILE *fp = fopen("F:\\notcode\\abc.txt","r"); if (!fp) return -1; char buf[1024];//为一行的内容准备空间 fgets(buf, 1024, fp); //只读取一行,遇到\n就结束 可以用循环来进行文件的全部读取 注意 阅读全文

posted @ 2020-01-19 15:32 不冒泡的苏打水 阅读(97) 评论(0) 推荐(0) 编辑

关于输入输出之类

摘要: 例如: 1. fputs(buf,fp);//是将字符串buf放到fp文件中 fgets(buf,fp);//是将fp中数据读取一行,放到字符串buf中 2. 格式化字符串数据: sscanf("123456","%s",buf);//是将123456数据放到字符串buf中 sprintf(buf, 阅读全文

posted @ 2020-01-19 11:23 不冒泡的苏打水 阅读(110) 评论(0) 推荐(0) 编辑

2020年1月18日

关于文件函数的简单使用,以及如何创建一个简单的vi编辑器

摘要: 读文件: #include <stdio.h> Int fgetc(FILE *stream); 功能:从stream指定文件中读取一个字符 参数: Stream:文件指针 //将一个字符从文件中读出 char ch = fgetc(fp); printf("%c\n", ch); //文件的指针没 阅读全文

posted @ 2020-01-18 14:16 不冒泡的苏打水 阅读(154) 评论(0) 推荐(0) 编辑

关于s_gets函数的理解

摘要: 例如: char *s_gets(char *st, int n){ char *ret_val; int i = 0; ret_val = fgets(st, n, stdin); if (ret_val)//当ret_val等于空字符时,ret_val值为0,测试条件为假,循环结束 { whil 阅读全文

posted @ 2020-01-18 14:03 不冒泡的苏打水 阅读(1144) 评论(0) 推荐(0) 编辑

2020年1月15日

day10内存结构

摘要: #define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <string.h>#include <stdlib.h> void fun01(int a)//此处的int a不同于主函数的int a,这个是属于fun01函数的{ int b = 阅读全文

posted @ 2020-01-15 11:47 不冒泡的苏打水 阅读(86) 评论(0) 推荐(0) 编辑

2019年12月22日

关于链表的功能(排序,添加,删除,判断长度,判断是否为空,遍历)

摘要: #include <stdio.h> #include <malloc.h> #include <stdlib.h> typedef struct node { int data//数据域 struct node * pnext;//指针域 }node,*pnode;(分号不能少)//node等价于 阅读全文

posted @ 2019-12-22 19:32 不冒泡的苏打水 阅读(321) 评论(0) 推荐(0) 编辑

2019年11月21日

字符串排序(比较字符串首字符大小进行排序)

摘要: #define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <string.h>#include <stdlib.h> //字符串排序 根据字符串首字符 按照a-z的顺序排序void bubble(char ** arr,int len){ f 阅读全文

posted @ 2019-11-21 20:35 不冒泡的苏打水 阅读(2022) 评论(0) 推荐(0) 编辑

2019年11月20日

用指针形式实现strstr函数

摘要: char * mystrstr(char *dest,char * src){ char *p=null; char * temp=src; while(*dest)//只要不为'\0'就行 { p=dest;//进行多次赋值操作 while(*dest==*temp) { dest++;//指向下 阅读全文

posted @ 2019-11-20 14:51 不冒泡的苏打水 阅读(297) 评论(0) 推荐(0) 编辑

用数组实现strstr函数

摘要: 用数组实现strstr函数char * mystrstr(char * dest, char *src){ int i = 0; int j = 0; //匹配个数 int count = 0; int len = strlen(src); char * p = NULL; while (dest[ 阅读全文

posted @ 2019-11-20 14:50 不冒泡的苏打水 阅读(387) 评论(0) 推荐(0) 编辑

2019年4月18日

指针(下)

摘要: 指针作为函数参数:#define _CRT_SECURE_NO_WARNINGS#include <stdlib.h>#include <string.h>#include <stdio.h>void print(int * arr,int len){ //函数参数中如果有指针 数组 都会转化为指针 阅读全文

posted @ 2019-04-18 22:18 不冒泡的苏打水 阅读(117) 评论(0) 推荐(0) 编辑

导航