Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-21-2013, 05:21 AM   #1
Bhupendra Singh
LQ Newbie
Registered: Jun 2013
Location: New Delhi
Posts: 1

Rep: Reputation: Disabled
Reading contents of a specific block of a file

Hello greetings of the day!!!

Sir, I want to read the contents of a block(cluster) of a file.Suppose my file name is test.txt (size=9200 bytes) and is allocated to 3 blocks(say 23,24,25). Now i want to read the contents of block 25 and want to know what is wriiten in the unused sectors of last block(25)?Suppose i want to hide data in the unused sectors(slack space) of the last block then how i can do this?

Please give me such program or command that can do this on linux.

thank you in advance.
Old 06-21-2013, 08:00 AM   #2
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
Take a look at the fseek() manual page (and look for some examples of using it with Google).

Hope this helps some.
1 members found this post helpful.
Old 06-21-2013, 08:56 PM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,842

Rep: Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472Reputation: 1472
Umm... files don't get "unused sectors". They are all defined - even the files with "holes" in the allocation (they are all zero bytes).

The last "block" may not be complete - files only have the bytes that are allocated - you can't read past the end of file.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Specific Block of Contents or Lines in Output Hi_This_is_Dev Linux - General 4 04-23-2010 07:36 PM
Create a Multiple files by reading a input file and changing the contents bhargavkr Linux - Newbie 4 09-17-2009 12:37 AM
Reading specific lines from a file Mork2k4 Programming 2 09-10-2009 11:51 PM
How to find a specific data block in a huge file and then do algebra on them? mcgao07 Linux - Newbie 6 03-16-2009 07:21 PM
find a specific file's location in a block-bitmap abhishek07 Linux - Kernel 0 06-28-2007 03:20 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration