how do i read a block

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Mon May 13 10:32:03 EDT 2013


On Mon, 13 May 2013 13:35:54 +0530, shampavman said:
> Hi all,
>
> Supposing i create a file of size 10K, it will occupy 2 blocks (4K each).
> Now if i want to read only 1 block from it how can i do it?
>
> read(fd, buf, 4096) ;
> would this mean i would read the first block and all its contents?

This isn't a kernel question, it's a C 101 question.

But yes, if you only want to read the first 4K, you just read the first 4K.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130513/49a9d745/attachment.bin 


More information about the Kernelnewbies mailing list