At about the time of 3/23/2007 1:08 PM, Flash Gordon stated the following:
> daya wrote, On 23/03/07 16:54:
>> To access the USB drive in raw mode in Linux...do not mount the drive.
>> Just search the device file in the folder /dev
>> It will probably be /dev/sda or /dev/sdc.
>>
>> Since all the devices are treated as files in linux.you can use the
>> file in raw mode
>> in C/C++ program
>
> I think you mean binary mode, C does not have a raw mode.
>
No, I mean raw device access mode in Unix, when the disk looks just like
a bunch of data blocks and you can view the partition table and
filesystem structures that the kernel uses to keep track of things on
the disk. In my case, it's a USB flash drive.
>> eg
>>
>> FILE* fp=fopen("/dev/sda","r");
>
> That would open it in text mode which is not what you want (although it
> does not make much difference on Linux). You should use "rb" for binary.
>
It would have to be binary mode.
>> etc.
>> For writing you may probably need to run the program as root.
>
> All this would be best discussed on a Linux or Unix programming group
> where the specifics of the system are topical. They are not topical here.
Which is why I posted a follow-up message indicating that I posted to
the wrong group. The poster that you replied to snipped my post that
made a statement to that fact.
--
Daniel Rudy
Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m
Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
|