Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/*
2
 *
3
 *
4
 *
5
 */
6
 
7
#include <ll/i386/cons.h>
8
#include <drivers/keyb.h>
9
 
10
#include <stdio.h>
11
#include <string.h>
12
 
13
int main(int argc,char *argv[])
14
{
15
  char buffer[256];
16
  FILE *fin;
17
  char *s;
18
  //  int res;
19
  int c;
20
 
21
  /*
22
  temp_device=bdev_scan_devices(choose_temp_callback);
23
  if (temp_device<0) {
24
    cprintf("can't find a filesystem to mount on /TEMP!!!\n");
25
    return -1;
26
  }
27
 
28
  res=mount(temp_device,FS_MSDOS,"/TEMP",NULL);
29
  if (res!=0) {
30
    cprintf("can't mount XXX on /TEMP (errno: %i)\n",errno);
31
    sys_end();
32
    return -1;
33
  }
34
  */
35
 
36
  /*
37
   *
38
   */
39
 
40
  cprintf("opening...\n");
41
  fin=fopen("/TEMP/ALFA2.TXT","r");
42
  cprintf("opened!\n");
43
 
44
  if (fin!=NULL) {
45
 
46
    while (!feof(fin)) {
47
      cprintf("getting line...\n");
48
      s=fgets(buffer,sizeof(buffer),fin);
49
      cprintf("got!\n");
50
      if (s==NULL) {
51
        if (ferror(fin))
52
          cprintf("error while using fgets()!\n");     
53
        break;
54
      }
55
      cprintf("'%s'\n",buffer);
56
    }
57
 
58
    cprintf("closing...\n");
59
    fclose(fin);
60
    cprintf("closed!\n");
61
  }
62
 
63
  cprintf("[press 'x' to exit]\n");
64
  while ((c = keyb_getchar()) != 'x') ;
65
 
66
  return 0;
67
}