- 博客(10)
- 收藏
- 关注
原创 第七章相关连接
#include <stdio.h>int time;int foo(int a) { int b = a + 1; return b;}int main(int argc, char *argv[]){ printf("%d\n", foo(5)); return 0;}运行结果:编译之后我们通过 readelf -S 查...
2019-12-07 23:34:27
166
原创 第十章相关 系统级i/o
1.打开和关闭文件#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int open(char *filename, int flags, mode_t mode);open()函数将filename转换为一个文件描述符,并且返回描述符数字filename:一个文件路径...
2019-12-07 23:01:50
150
原创 第八章相关
fork()函数:(1)fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程,也就是两个进程可以做完全相同的事,但如果初始参数或者传入的变量不同,两个进程也可以做不同的事。(2)一次调用,两次返回。如果返回值为0,则表示当前子进程中;若大于0,则说明在父进程中,返回值为父进程的pid。程序进程图画法:进程图是刻画程序语句的偏序的一种简单的前驱图。每个顶点a对应一条程序...
2019-12-07 21:15:47
254
原创 编程日志8
runaway程序#include <stdio.h>#include <stdlib.h>int recurse(int x) { int a[1<<15]; /* 4 * 2^15 = 64 KiB */ printf("x = %d. a at %p\n", x, a); a[0] = (1<<14...
2019-05-23 22:03:57
134
原创 编程日志6
locate程序#include <stdlib.h>#include <stdio.h>#include <unistd.h>static void show_pointer(void *p, char *descr) { // printf("Pointer for %s at %p\n", descr, p); pri...
2019-05-23 21:57:31
137
原创 编程日志5
fsum程序#include <stdio.h>#include <stdlib.h>#include <string.h>#define BUFSIZE 256int main(int argc, char *argv[]) { char prefix[BUFSIZE]; char next[BUFSIZE]; int i;...
2019-05-23 21:39:46
204
原创 编程日志4
/* Demonstration of buffer overflow */#include <stdio.h>#include <stdlib.h>/* Implementation of library function gets() */char *gets(char *dest){ int c = getchar(); char *p = ...
2019-05-23 21:32:26
228
原创 编程日志3
SQ程序#include <stdio.h>#include <stdlib.h>int sq(int x) { return x*x;}int main(int argc, char *argv[]) { int i;for (i = 1; i < argc; i++) { int x = atoi(argv[i]);...
2019-05-23 21:22:25
170
原创 编程日志2
struct程序#include <stdio.h>#include <stdlib.h>typedef struct { int a[2]; double d;} struct_t;double fun(int i) { volatile struct_t s; s.d = 3.14; s.a[i] = 10737...
2019-05-18 12:39:17
276
原创 编程日志1
showbyte程序/* show-bytes - prints byte representation of data *//* $begin show-bytes */#include <stdio.h>/* $end show-bytes */#include <stdlib.h>#include <string.h>/* $begin ...
2019-05-18 12:27:57
401
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人