Re: read random blocks on block device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...
I need to write a C program that will accomplish these things:
- read the name of a block device from the command line (e.g. myprog /dev/sda)
- open that block device in raw mode, read only
- read a random block, discard, repeat (infinite loop)
A quick answer: the usual read() C function will serve you well. It doesn't matter if you use it to read normal file or device, it's all treated as file. Pls read "man 2 read" for further information.

Just out of couriousity, why do you need a C program to do that? can you just do it by using "dd"?

regards,

Mulyadi


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux