ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7


5 - A Big Gulp

For the gluttons amongst you, it IS possible to read the whole file in, since the file's size is known:
  ebo_enumerator_t file;

  <<< fill the 'file' structure from the dialog >>>

  if (file.vdev) // not ram? (==0 if ram)
  {
    m_mmcBuffer=new unsigned char[file.size];
    off_t offset=0;
    size_t size=ebo_iread(file.index,m_mmcBuffer,offset,file.size);
    switch (size)
    {
      case EBO_NOEXISTS:
      case EBO_IO:
        GUI_Alert(ALERT_WARNING,"Unable to read MMC file! ");
        return;
      default:
        break;
    }
  }

  <<< file now in m_mmcBuffer >>>

Reading in a portion instead of everything is just a matter of reusing the above code, but specifying a different offset and size value for ebo_iread().

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice