OILS / demo / ld_preload_main.c View on Github | oilshell.org

26 lines, 18 significant
1#include <stdio.h>
2#include <stdlib.h>
3
4int main(void) {
5 char* p;
6 for (int i = 0; i < 10; ++i) {
7#if 0
8 p = mi_malloc(1000);
9#else
10 p = malloc(1000);
11#endif
12 printf("p = %p\n", p);
13 }
14
15 printf("Calling the fopen() function...\n");
16
17 FILE* fd = fopen("test.txt", "r");
18 if (!fd) {
19 printf("fopen() returned NULL\n");
20 return 1;
21 }
22
23 printf("fopen() succeeded\n");
24
25 return 0;
26}