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


4 - Handling the Result

You display the dialog and get a file selection - now what? Well, as has already been mentioned, you can tell whether you are dealing with an MMC or RAM file by looking at the 'vdev' flag of the returned ebo_enumerator_t structure. This presents you with two options:

  • If a RAM file, map in with ebo_mapin() A previous article on this site dealt with file I/O, and included code for opening a file by passing it a ebo_name_t parameter, which is the 'name' field of the ebo_enumerator_t structure passed back.
  • If a MMC file, you will need to move all or part of it to main memory, where it can be manipulated. We'll consider this case in more detail.

More than likely, you don't want to read a whole MMC file into main memory, as you'll risk running out of memory with larger files. You can read in a portion of a MMC file with the following call:

  long ebo_iread (int idx, void *buf, off_t offset, size_t count);

This function is passed the index from the MMC item you've found (the 'index' field of the ebo_enumerator_t structure), as well as a pointer to a storage buffer, a file offset, and a copy count. The return value is the length of data copied. Again, the buffer you pass should be big enough to hold it.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice