WengQiang's Blog

where there is a will, there is a way!

c中读取输出

  1. 单个字符 int fgetc( FILE *stream ); int fputc( int ch, FILE *stream );

    int ungetc( int ch, FILE *stream );

    ​int scanf( const char* format, ... ) int fscanf( std::FILE* stream, const char* format, ... ) int sscanf( const char* buffer, const char* format, ... ) 返回读取的参数的数量, or EOF The conversion specifiers that do not consume leading whitespace: %c、%[、%n
    阅读全文 »

温度表示法互相转换

C = (5/9)(F - 32)

sizeof('a')的值

sizeof('a'): c中'a'的字符常量是int型, 所以输出4. c++中是char型,所以输出1.

Linux program startup

c linux startup
c linux startup
  1. the shell or gui calls execve() which execute linux system call execve(), it will set up a stack for you, and push onto it argc, argv, envp. the filedescription 0, 1, 2 are left to whatever the shell set them to. The loader does much work for you setting up your relocations, and as we'll see much later, calling your preinitializers. When everything is ready, control is handed to your program by calling _start().

escape sequences in c

escape sequence
escape sequence

/000 ---- / 后面1,2,or 3三个8进制的数,表示character在character set中的值 /xhh ----- / 后面任意个16进制的数,表示character在character set中的值

阅读全文 »

cdecl

Cdecl (and c++decl) is a program for encoding and decoding C (or C++) type declarations.

cdecl online website

size(on mac)

size -- print the size of the sections in an object file. size -x(print by hex) -l -m a.out

阅读全文 »
0%