On Thu, Feb 22, 2024 at 12:08:14PM +0000, Sad Clouds wrote: > Hello, thanks to everyone who responded with their suggestions. Using > various non-portable ioctls I can device size on most platforms, for > both block and raw devices. > > This is more convoluted than a single lseek() call, but it is what it > is. If anyone wants to do something similar, then the following example > can give you a good start.
Probably not a good idea to start with lseek() because if you _do_ encounter a tape device, seeking to SEEK_END could take you an extremely long time. Thor