Subversion Repositories shark

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 *
 *
 *
 */


#include <kernel/func.h>

#include <fs/bdevinit.h>
#include <fs/fsinit.h>
#include <fs/bdev.h>

#include <drivers/keyb.h>

#include <sys/mount.h>

#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

#include "common.h"

#define FILENAME "/TEMP/ALFA1.TXT"

int main(int argc,char *argv[])
{
  int c;
  int h;
  //  int res;

  cprintf("OPENING %s\n",FILENAME);  
  h=open(FILENAME,O_RDONLY);
  if (h>=0) {
    char buffer[128];
    int len;
    cprintf("OPENED!\n");

    cprintf("READING...\n");
    len=read(h,buffer,sizeof(buffer));
    cprintf("READ %i bytes\n",len);
    memset(buffer,'\0',sizeof(buffer));
    cprintf("buffer='%s'\n",buffer);

    cprintf("READING...\n");
    len=read(h,buffer,sizeof(buffer));
    cprintf("READ %i bytes\n",len);
    memset(buffer,'\0',sizeof(buffer));
    cprintf("buffer='%s'\n",buffer);

    //close(h);
   
  } else
    cprintf("FAILED!\n");
 
  cprintf("Press [x] to exit\n");
 
  while ((c = keyb_getchar()) != 'x') ;

  //bdev_dump_status();
 
  return 0;
}