随笔分类 -  C

摘要:之前写的一个小工具,写的很简陋,名字取的也很随意就叫skr,哈哈。主要是fq转fa、合并多个染色体的vcf文件等,功能不多(主要是C写起来太操蛋了T_T),通常我也只用来统计fastq文件信息: 这里给出工具地址:https://github.com/sharkLoc/skrTools 安装: gi 阅读全文
posted @ 2021-09-29 13:56 天使不设防 阅读(1023) 评论(1) 推荐(0) 编辑
摘要:再改进下上次的读入一行函数,利用zlib库的gzgtec函数读取文件,动态分配内存,最后没有多出空行。 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <zlib.h> 5 6 char *rea 阅读全文
posted @ 2020-11-10 15:37 天使不设防 阅读(146) 评论(0) 推荐(0) 编辑
摘要:在之前的博客中 https://www.cnblogs.com/mmtinfo/p/13036039.html 读取一行的getline()函数是GNU 的扩展函数。 这里用自定义函数实现这个功能,从文件中读取整行,不论一行多长,动态分配内存。 1 #include <stdlib.h> 2 #in 阅读全文
posted @ 2020-11-06 19:47 天使不设防 阅读(354) 评论(0) 推荐(0) 编辑
摘要:修改可读取压缩格式文件 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <zlib.h> 5 6 #define RLEN 1024 7 8 static void getfq(char *fq) 阅读全文
posted @ 2020-11-04 17:17 天使不设防 阅读(214) 评论(0) 推荐(0) 编辑
摘要:目前只能处理短序列,若要处理长序列,可按照https://www.cnblogs.com/mmtinfo/p/13036039.html的读取方法。 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #define 阅读全文
posted @ 2020-11-04 10:34 天使不设防 阅读(308) 评论(0) 推荐(0) 编辑
摘要:字符串存入数组 文本内容: line1_1 line1_2line2_1 line2_2line3_1 line3_2line4_1 line4_2line5_1 line5_2line6_1 line6_2 C代码: 1 #include <stdlib.h> 2 #include <stdio. 阅读全文
posted @ 2020-11-03 15:43 天使不设防 阅读(2032) 评论(0) 推荐(0) 编辑
摘要:1 static char *revers(char *s) 2 { 3 int len=strlen(s); 4 char *s2=(char *)malloc(sizeof(char)*(len+1)); 5 for(int i=len-1; i>=0; i--) 6 { 7 switch (s 阅读全文
posted @ 2020-10-28 11:22 天使不设防 阅读(401) 评论(0) 推荐(0) 编辑
摘要:利用getdelim函数分割读取字段,将文件制表符替换为空格符 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main(int argc, char *argv[]) 5 { 6 char *line = NULL; 7 FILE *fp; 8 阅读全文
posted @ 2020-10-19 10:08 天使不设防 阅读(1254) 评论(0) 推荐(0) 编辑
摘要:指向指针数组的指针。 1 #include <stdio.h> 2 3 int main(void) 4 { 5 char *pa[4]={"aaaaa","bbbbb","ccccc","ddddd"}; // 类型: char* (*)[4] 6 7 char** p=pa; // 指针p指向一 阅读全文
posted @ 2020-10-08 16:27 天使不设防 阅读(161) 评论(0) 推荐(0) 编辑
摘要:C语言一级指针指向一级指针 和二级指针指向一级指针的区别! 1 #include <stdio.h> 2 #include <string.h> 3 4 int main(void) 5 { 6 char s1[]="hello"; 7 char *p = s1; 8 char *q = p; 9 阅读全文
posted @ 2020-09-30 18:02 天使不设防 阅读(111) 评论(0) 推荐(0) 编辑
摘要:很简陋,没有做输入校验,以写出来为第一目的,中间出了不少问题,尤其是结构体内字符串赋值的时候(理解不透彻😔),字符串比较用strcmp不能直接==判定,逻辑也很重要,不然会出现莫名其妙的问题。 涉及知识:结构体 数组 字符串 1 #include <stdlib.h> 2 #include <st 阅读全文
posted @ 2020-09-30 15:04 天使不设防 阅读(142) 评论(0) 推荐(0) 编辑
摘要:字符串指针和字符串数组使用区别 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 5 int main(void) 6 { 7 char str1[]="this is str1!"; 8 puts(str1); 9 阅读全文
posted @ 2020-09-29 23:39 天使不设防 阅读(483) 评论(0) 推荐(0) 编辑
摘要:do while 循环小练习 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main(void) 5 { 6 int a; 7 do{ 8 fprintf(stdout,"%s\n","请输入一个整数:"); 9 scanf("%d",&a); 阅读全文
posted @ 2020-09-22 19:32 天使不设防 阅读(205) 评论(0) 推荐(0) 编辑
摘要:改进了一下,利用zlib可以读取gz格式的压缩文件,也可以直接计算非压缩格式 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <zlib.h> #define buff 1024 typedef unsigned 阅读全文
posted @ 2020-09-21 15:13 天使不设防 阅读(227) 评论(0) 推荐(0) 编辑
摘要:C语言小练习:计算非压缩fastq格式的GC含量 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #define buff 1024 5 6 typedef unsigned long long int u_llo 阅读全文
posted @ 2020-09-21 14:38 天使不设防 阅读(295) 评论(0) 推荐(0) 编辑
摘要:getline() 函数无论一行多长,动态分配内存读入行 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 int main(int argc,const char *argv[]) 6 { 7 FILE *fp 阅读全文
posted @ 2020-06-03 10:47 天使不设防 阅读(1778) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示