2014年5月2日

sscanf的应用

摘要: 1.提取字符串2.提取指定长度的字符串3.提取指定字符为止的字符串4.取仅包含指定字符集的字符串5.取到指定字符集为止的字符串#include int main(){ char str[512]={0}; sscanf("123456","%s",str); printf("str... 阅读全文

posted @ 2014-05-02 12:11 lakeone 阅读(140) 评论(0) 推荐(0) 编辑

获取CPU频率

摘要: #include #include float get_cpu_clock_speed(){ FILE *fp; char buffer[1024]; size_t bytes_read; char *match; float clock_speed; fp=fo... 阅读全文

posted @ 2014-05-02 11:58 lakeone 阅读(987) 评论(0) 推荐(0) 编辑

打印随机数到字符串中

摘要: #include #include #include int main(){ srand(time(0)); char s[64]; int offset=0; int i; for(i=0;i<10;i++) { offset+=sprintf(s... 阅读全文

posted @ 2014-05-02 11:40 lakeone 阅读(180) 评论(0) 推荐(0) 编辑

printf/scanf格式

摘要: (1)打印字符char c;printf("%c",c);(2)打印整形int i;printf("%d",i); //有符号十进制数printf("%u",i); //无符号十进制数(3)打印浮点数float f;printf("%f",f);(4)打印指针int *p;pri... 阅读全文

posted @ 2014-05-02 10:57 lakeone 阅读(234) 评论(0) 推荐(0) 编辑

用fread和fwrite实现文件复制操作

摘要: #include #include #include int main(int argc,char **argv){ FILE *fp_src,*fp_des; char buf[128]; int num; if(argc!=3) { printf("t... 阅读全文

posted @ 2014-05-02 10:33 lakeone 阅读(1801) 评论(0) 推荐(0) 编辑

用fseek和ftell获取文件的大小

摘要: #include #include #include int main(int argc,char *argv[]){ int n=0; FILE *fp; if((fp=fopen(argv[1],"r"))==NULL) { perror("fopen");... 阅读全文

posted @ 2014-05-02 09:54 lakeone 阅读(933) 评论(0) 推荐(0) 编辑

ecl函数的用法

摘要: 相关函数fork, execle, execlp, execv, execve, execvpWindows下头文件#include Linux下头文件#include 函数定义int execl(const char *path, const char *arg, ...);函数说明execl()... 阅读全文

posted @ 2014-05-02 09:46 lakeone 阅读(455) 评论(0) 推荐(0) 编辑

导航