7 Years
Discussion Span
Last Post by Narue

In a way that's the only way to read from disk. If you are interested in how to do file I/O manually then I suggest you get familiar with the C++ functions fput, fget, fseek, etc. If you are asking whether sth like double* pDbl can be made to point to a location on the hard-drive then normally no. Pointers point to the programs memory space, but I'm pretty sure with some hackery you could force it to point to storage. Why would you want to do that, though? a pointer is normally a 4-byte word on 32-bit-machines and a 8-byte word on 64-bit-machines. the addressable storage with those pointers would be rather too small for todays hard-drives of a terra-byte size or so.
with a pointer you could only access a fraction of that.


Is it possible to have a pointer to something (say a string) that is on the hard disk?

For a very liberal definition of "pointer", yes. But if you mean a C++ pointer type, no.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.