- 论坛徽章:
- 0
|
这是我的代码:
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <fcntl.h>
6 #include <sys/stat.h>
7 #include <sys/types.h>
8
9 #ifdef HAVE_MMAP
10 #include <sys/mman.h>
11 #endif
12
13 #include <sys/file.h>
14
15 int main (int argc, char ** argv)
16 {
17
18 int fd = open("x", O_RDWR);
19 char * c = malloc(10000);
20 memset(c, 0, 10000);
21
22 write (fd, c, 10000);
23 lseek(fd, 1000, SEEK_SET);
24 write (fd, "ccccccc", 10);
25 close(fd);
26
27 printf("%s\n", *argv);
28 }
29
编译之后,跑一下,然后:
[occa]:/build/pgsql/cfile--> cat x
ccccccc%s[occa]:/build/pgsql/cfile-->
这个东西 %s 是怎么跑进来的呢? |
|