go的匿名函数: func no_func() { // 匿名函数 1 f := func(i, j int) (result int) { // f 为函数地址 result = i + j return result } fmt.Fprintf(os.Stdout, "f = %v ?f(1,3) = %v\n", f, f(1, 3)) // 匿名函...
分类:
其他好文 时间:
2015-07-20 14:36:57
阅读次数:
141
部分代码来自MOOC
#include
#include
#include
void parse_F();
void parse_T();
void parse_E();
void error (char *want, char got);
int i;
char *str = 0;
void error (char *want, char got)
{
fprintf (stderr, "Compling this expressi...
分类:
其他好文 时间:
2015-07-13 22:32:19
阅读次数:
166
在此之前先区分一下:printf,sprintf,fprintf。
1、printf就是标准输出,在屏幕上打印出一段字符串来。
#include
原型:void printf(const char
*format,[argument]);
功能:一般用于向标准输出设备按规定格式输出信息。
2、sprintf就是把格式化的数据写入到某个字符串中。返回值字符串的长...
分类:
其他好文 时间:
2015-07-10 11:21:17
阅读次数:
143
在调试程序时,有时候要输出大量数据,如果让printf/fprintf改变输出数据的颜色,那观察数据就方便多了。终端的字符颜色是用转义序列控制的,是文本模式下的系统显示功能,和具体的语言无关。转义序列是以 ESC 开头,可以用 \033 完成相同的工作(ESC 的 ASCII 码用十进制表示就是 2...
分类:
其他好文 时间:
2015-07-07 19:14:08
阅读次数:
119
fopen :打开文件
fread :读文件
fwrite : 写文件
fgetc : 读字符
fputc : 写字符
fscanf : 格式化读
fprintf : 格式化写
fseek : 文件偏移量定位
getcwd 、getwd、get_current_dir_name : 获取当前路径
mkdir : 创建目录
feof : 检测文件尾
ferror : 检测文...
分类:
系统相关 时间:
2015-06-28 06:28:48
阅读次数:
312
1. 注册所有解码器av_register_all();2. Codec & CodecContextAVCodec* codec = avcodec_find_decoder(CODEC_ID_AAC);if (!codec){fprintf(stderr, "codec not found\n"...
分类:
其他好文 时间:
2015-06-17 10:53:21
阅读次数:
116
上篇是文件操作(第三章上),文章中的代码在文件操作(代码下载)。
3.6 格式化输出和输入
3.6.1 printf、fprintf和sprintf函数
printf函数能够对各种不同类型的参数进行格式化编排和输出。每个参数在输出流中的表示形式由格式化参数format控制,它是一个包含需要输出的普通字符和转换控制符代码的字符串。
#include
int printf(const ...
分类:
系统相关 时间:
2015-06-05 17:40:41
阅读次数:
207
一、 一个简单TCP回射服务端程序
#include "unp.h"
#define MAXLINE 1024
#define PORT 13
#define CONMAX 5
void err_sys(const char* s)
{
fprintf(stderr, "%s\n",s);
exit(1);
}
void str_echo(int connfd)
{
in...
分类:
其他好文 时间:
2015-05-29 15:49:18
阅读次数:
127
#define SXLog(FORMAT, ...) fprintf(stderr,"file --\t%s\nline --\t%d\nmethd --\t%s\noutput --\t\n\n%s\n",[[[NSString stringWithUTF8String:__FILE__...
分类:
其他好文 时间:
2015-05-24 23:28:12
阅读次数:
263
http://blog.csdn.net/yrj/article/details/4924041、GCC的编译和安装2、预处理 #define 可以支持不定数量的参数。 例子如下: #define err(...) fprintf(stderr,__VA_ARGS__) err("%s,%d/r/n...
分类:
其他好文 时间:
2015-05-22 00:01:36
阅读次数:
322