0

Is there any special that needs to be done or taken into consideration when directly opening a block device (such as a HDD)?

Does the normal fopen and/or std::fstream (and their related tell/seek/read/write functions), or do special functions/classes have to be used?

Do they allow truly random seeking, or is there a strict limiting to reading whole blocks at a time? If the former, is there a significant performance penalty to not doing block-wise reading (compared to the same sorts of reads of a file on a "regular" filesystem)?

This will be on OS-X and, in the near future, other POSIX-based OSes (with the Linux kernel, not the BSD kernel), primarily using stl classes when available.

iAdjunct
  • 2,739
  • 1
  • 18
  • 27
  • No limit at software layer, but is limited at hardware level. Random seeking should not produce wrong results, but can be very slow (low performance). – iBug Feb 05 '18 at 03:54
  • This is not portable, of course - the Standard says they work on files. Your implementation may allow HDD access as an extension, but we can't tell that without knowing your implementation. (Practically speaking, which C++ Standard Library you're using) – MSalters Feb 05 '18 at 08:26
  • C++11 with clang on OS X as a baseline, though there may be a point where I need to support C++03 and gcc 4.4 series on RHEL 5/6 :( – iAdjunct Feb 05 '18 at 12:00

0 Answers0