Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1882 | clevermous | 1 | #include |
2 | #include |
||
3 | |||
4 | char * xbuf; |
||
5 | unsigned long sz; |
||
6 | |||
7 | int main(void) |
||
8 | { |
||
9 | FILE * fp; |
||
10 | chdir("/hd/1/menuetos/doom"); |
||
11 | __libclog_printf("Opening file ..."); |
||
12 | fp=fopen("doom1.wad","rb"); |
||
13 | if(!fp) |
||
14 | { |
||
15 | __libclog_printf("failed\n"); |
||
16 | return 1; |
||
17 | } |
||
18 | __libclog_printf("OK\n"); |
||
19 | fseek(fp,0,SEEK_END); |
||
20 | sz=ftell(fp); |
||
21 | fseek(fp,0,SEEK_SET); |
||
22 | xbuf=malloc(sz); |
||
23 | if(!xbuf) |
||
24 | { |
||
25 | __libclog_printf("Unable to malloc %u bytes\n",sz); |
||
26 | return 1; |
||
27 | } |
||
28 | __libclog_printf("Reading ..."); |
||
29 | fread(xbuf,1,sz,fp); |
||
30 | __libclog_printf("done\n"); |
||
31 | fclose(fp); |
||
32 | return 0; |
||
33 | } |