Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1085 | pj | 1 | /* |
2 | * |
||
3 | * |
||
4 | * |
||
5 | */ |
||
6 | |||
7 | #include <kernel/func.h> |
||
8 | |||
9 | #include <fs/bdevinit.h> |
||
10 | #include <fs/fsinit.h> |
||
11 | #include <fs/bdev.h> |
||
12 | |||
13 | #include <drivers/keyb.h> |
||
14 | |||
15 | #include <sys/mount.h> |
||
16 | |||
17 | #include <fcntl.h> |
||
18 | #include <unistd.h> |
||
19 | #include <errno.h> |
||
20 | #include <string.h> |
||
21 | |||
22 | #include "common.h" |
||
23 | |||
24 | #define FILENAME "/TEMP/ALFA1.TXT" |
||
25 | |||
26 | int main(int argc,char *argv[]) |
||
27 | { |
||
28 | int c; |
||
29 | int h; |
||
30 | // int res; |
||
31 | |||
32 | cprintf("OPENING %s\n",FILENAME); |
||
33 | h=open(FILENAME,O_RDONLY); |
||
34 | if (h>=0) { |
||
35 | char buffer[128]; |
||
36 | int len; |
||
37 | cprintf("OPENED!\n"); |
||
38 | |||
39 | cprintf("READING...\n"); |
||
40 | len=read(h,buffer,sizeof(buffer)); |
||
41 | cprintf("READ %i bytes\n",len); |
||
42 | memset(buffer,'\0',sizeof(buffer)); |
||
43 | cprintf("buffer='%s'\n",buffer); |
||
44 | |||
45 | cprintf("READING...\n"); |
||
46 | len=read(h,buffer,sizeof(buffer)); |
||
47 | cprintf("READ %i bytes\n",len); |
||
48 | memset(buffer,'\0',sizeof(buffer)); |
||
49 | cprintf("buffer='%s'\n",buffer); |
||
50 | |||
51 | //close(h); |
||
52 | |||
53 | } else |
||
54 | cprintf("FAILED!\n"); |
||
55 | |||
56 | cprintf("Press [x] to exit\n"); |
||
57 | |||
58 | while ((c = keyb_getchar()) != 'x') ; |
||
59 | |||
60 | //bdev_dump_status(); |
||
61 | |||
62 | return 0; |
||
63 | } |