[En-Nut-Discussion] Xflash problem!!!

Michael Fischer fischermi at t-online.de
Sat Feb 4 16:05:19 CET 2006


Hello,

I do not use fopen or some other fxxx functions.
NutHttpProcessFileRequest (httpd.c) use _open, _read, _close.

Here is a small example which has no problems, and the file could
be open again after _close.

   int   fd;
   char  Buffer[512];
   long lFileSize;
   int  nSize;
   int  nReadCount;

   fd  = _open("XFLASH:index.html", _O_BINARY | _O_RDONLY);
   if (fd != -1)
   {
      nSize     = 512;
      lFileSize = _filelength(fd);
      while (lFileSize)
      {
         if (lFileSize < 512L)
         {
            nSize = (int)lFileSize;
         }

         nReadCount = _read(fd, Buffer, nSize);
         lFileSize -= (long)nReadCount;
      }

      _close(fd);
   }

I use here a buffer size of only 512 bytes, because my other FAT functions
works
internally with a sector buffer of 512 bytes too.

@Harald,
what should we use for the application, the _xxx functions, or fxxx?

Regards,

Michael





More information about the En-Nut-Discussion mailing list