473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

raeding disk block in linux

kg
how to read the disk block in linux using c .. and also i want to
display the information like number of sectors in the disk ..number of
free sector .. totaly i want to display the partion informaation

May 10 '06 #1
2 5069

kg wrote:
how to read the disk block in linux using c .. and also i want to
display the information like number of sectors in the disk ..number of
free sector .. totaly i want to display the partion informaation


One of the Linux groups can surely help. Standard C does not provide
any such features. You could also have a look at Linux tools that do
the same thing. Getting their source shoudl be a doddle.

May 10 '06 #2
Ico
kg <kg*******@gmail.com> wrote:
how to read the disk block in linux using c .. and also i want to
display the information like number of sectors in the disk ..number of
free sector .. totaly i want to display the partion informaation


In linux, like most unices, the raw disk is available as a special file
in the /dev filesystem. You can use the standard C file I/O functions to
access these files:

#include <stdio.h>

int main(void)
{
FILE *f;
char block[512];
int r;

f = fopen("/dev/hda", "r");
if(f == NULL) exit(EXIT_FAILURE);

r = fread(block, 1, sizeof(block), f);

/* Do something with the data */

return 0;
}

For more information about those special device files and their
contents, you better ask the proper *.linux.* newsgroup.

--
:wq
^X^Cy^K^X^C^C^C^C
May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: zyqnews | last post by:
hello all, I now have a simple project. It is to test the change of use disk, when a new usb disk is plugged into the usb socket, the program will copy a file to the usb disk, then disabled the...
1
by: news | last post by:
OP wrote: }in order to justify learning another language I'd first need to be }convinced that python could easily do the following:- } }ReadSectors2Bufr(hdx, StartSectr, SectrCnt, Bufr); <-- like...
13
by: Shane Wright | last post by:
Hi, I've been trying to spec a new server for my company's database for a few weeks and one of the biggest problems I've had is trying to find meaningful performance information about how...
8
by: Foodbank | last post by:
Hi, Has anyone ever hashed a text file to disk before? I'm trying to convert an in-memory hash to disk hash and I can't find any relevant information to help me. Also, I'd like to use lseek,...
6
by: PyPK | last post by:
how can we compute the current system disk space using a python script.? any ideas or have anyone tried this..
6
by: nichughes | last post by:
Hello all, A question relating to http://www.entrust-systems.net/ Just for a change I have run into a problem that seems to be OS specific rather than browser specific - the box image that is...
1
by: okonita | last post by:
Hi all, This is a very urgent issue for my team. We are trying a Redirected restore the most current online DB2 UDBv8.2 backup copy from prod disk to disk on another/test instance. Our...
1
by: rada.lambretha | last post by:
Configuring Linux as a Firewall * Making installation choices * Introducing iptables * Using iptables commands * Simplifying things with firewall GUIs * Adding proxy functionality As...
1
Nepomuk
by: Nepomuk | last post by:
In most modern distributions of Linux and Unix (at least ones with graphical environments like KDE, Gnome or XFCE), you get to mount your partitions easily from the desktop. In some cases however, it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.