随笔分类 -  [020_C编程Linux]

摘要:用printf语句打印一下内容 printf("Content-Type: application/octet-stream-dummy\n"); printf("Content-Disposition: filename=%s\n\n", dwnFileName[0]); fwrite(comtbp, sizeof(struct stcomtb), 1, stdout); 阅读全文
posted @ 2012-04-12 19:08 邵贤军 阅读(352) 评论(0) 推荐(0) 编辑
摘要:内存结构体=>文件#include <stdio.h>#include <stdlib.h>const char* fileName = "/home/fnst/temp/dwntest/file.bin";struct Person{ char sex; int age;};int main(){ /*simulate the comtb in the memory*/ struct Person person; person.sex = 'M'; person.age = 12; /*write memory to the 阅读全文
posted @ 2012-04-12 19:06 邵贤军 阅读(354) 评论(0) 推荐(0) 编辑
摘要:写了一个简单的程序,但是考虑到有一些信息是需要打印在控制台上的,就像在windows上启动apache tomcat时控制台显示的信息一样。琢磨一会儿之后,对printf进行了封装,支持控制台打印日志,支持输出到文件里。不过控制台都是固定颜色的,不好看。于是在网上找了一下资料,printf还真支持输出不同的颜色,如下:实例:printf("\033[1;33m Hello World. \033[0m \n");\033 [1; 33m xxxx| | | |开始 背景色 字体色 字符串一些常见的颜色代码:none = "\033[0... 阅读全文
posted @ 2012-03-29 00:40 邵贤军 阅读(3379) 评论(3) 推荐(0) 编辑

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