随笔 - 493  文章 - 0  评论 - 97  阅读 - 239万
  2011年4月10日
摘要: /* 功能: 获取当前系统时间 返回值: 0-成功,-1-失败 out: 保存返回的系统时间,格式由fmt决定 fmt: 0-返回:yyyy-mm-dd hh24:mi:ss, 1-返回:yyyy-mm-dd, 2-返回:hh24:mi:ss*/int getTime(char *out, int fmt) // 获取当前系统时间{ if(out == NULL) return -1; time_t t; struct tm *tp; t = time(NULL); tp = localtime(&t); if(fmt == 0) sprintf(out, "%2.2d-%2 阅读全文
posted @ 2011-04-10 18:25 清清飞扬 阅读(10413) 评论(1) 推荐(1) 编辑
摘要: 使用的是 Fedora 10 gcc编译下面程序 显示warning: the `gets' function is dangerous and should not be used.问题出在程序中使用了 gets Linux 下gcc编译器不支持这个函数,解决办法是使用 fgetsfgets()函数的基本用法为:fgets(char * s,int size,FILE * stream);/* 代码实现 */#include <stdio.h>int main ( ) { char name[20]; printf("\n 输入任意字符 : "); f 阅读全文
posted @ 2011-04-10 13:26 清清飞扬 阅读(3089) 评论(1) 推荐(0) 编辑
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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