473,386 Members | 1,823 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,386 software developers and data experts.

How to read/write raw bytes from a flash card in C++?

Hi, group:

I am intermediate in C programming, basically I programmed in Unix for
digital signal processing...

Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia
card...I can view the raw data in WinHex...now what I want is, in generic C
codes to read all the data
I see in WinHex...

Could anybody teach me on how to handle this kind of work? Any websites are
welcome.

Best Regards,
Kelvin

Nov 14 '05 #1
9 7473
In comp.lang.c Kelvin @ SG <ke********@hotmail.com> wrote:
Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia


Your post is off-topic for comp.lang.c. Please visit

http://www.csclub.uwaterloo.ca/u/dj3...lc-welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
By the way, I actually understands FAT, I need to know the functions and
headers in C that
allows me to implement a simple reader for FAT...Some example codes and
websites will
be great.

Kelvin

"Kelvin @ SG" <ke********@hotmail.com> wrote in message
news:c0**********@reader01.singnet.com.sg...
Hi, group:

I am intermediate in C programming, basically I programmed in Unix for
digital signal processing...

Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia
card...I can view the raw data in WinHex...now what I want is, in generic C codes to read all the data
I see in WinHex...

Could anybody teach me on how to handle this kind of work? Any websites are welcome.

Best Regards,
Kelvin

Nov 14 '05 #3
"Kelvin @ SG" <ke********@hotmail.com> wrote in
news:c0**********@reader01.singnet.com.sg:
By the way, I actually understands FAT, I need to know the functions and
headers in C that
allows me to implement a simple reader for FAT...Some example codes and
websites will
be great.


Your still off-topic. Try this question in comp.arch.embedded - not a
language ng.

--
- Mark ->
--
Nov 14 '05 #4
In <c0**********@reader01.singnet.com.sg> "Kelvin @ SG" <ke********@hotmail.com> writes:
I am intermediate in C programming, basically I programmed in Unix for
digital signal processing...

Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia
card...I can view the raw data in WinHex...now what I want is, in generic C
codes to read all the data
I see in WinHex...


fopen on the raw device and then fread should do the job if you want to
bypass the file system.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #5
Mark A. Odell wrote:

"Kelvin @ SG" <ke********@hotmail.com> wrote in
news:c0**********@reader01.singnet.com.sg:
By the way, I actually understands FAT,
I need to know the functions and headers in C that
allows me to implement a simple reader for FAT
...Some example codes and websites will be great.


Your still off-topic. Try this question in comp.arch.embedded - not a
language ng.


When I was interested in File Allocation Tables,
I read my compiler documentation to find nonstandard functions
which dealt with the topic.
I don't recall anything about the topic,
which would suggest that there was an embedded aspect to it.

--
pete
Nov 14 '05 #6
pete wrote:
Mark A. Odell wrote:
"Kelvin @ SG" <ke********@hotmail.com> wrote in
news:c0**********@reader01.singnet.com.sg:

By the way, I actually understands FAT,
I need to know the functions and headers in C that
allows me to implement a simple reader for FAT
...Some example codes and websites will be great.


Your still off-topic. Try this question in comp.arch.embedded - not a
language ng.

When I was interested in File Allocation Tables,
I read my compiler documentation to find nonstandard functions
which dealt with the topic.
I don't recall anything about the topic,
which would suggest that there was an embedded aspect to it.


The _standard_ C language has no facilities for File
Allocation Tables. File allocation is an operating
systems topic and best discussed in a newsgroup that
discusses your operating system.

A File Allocation Table (FAT) is a mapping that shows
what chunks of a file system are allocated. Many
file based operating systems will use an array of
bits for this.

Some OS's might also indicate what file is occupying
which chunks.

But all of this has nothing to do with the C language.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Nov 14 '05 #7
pete <pf*****@mindspring.com> wrote in news:40***********@mindspring.com:
> By the way, I actually understands FAT,
> I need to know the functions and headers in C that
> allows me to implement a simple reader for FAT
> ...Some example codes and websites will be great.


Your still off-topic. Try this question in comp.arch.embedded - not a
language ng.


When I was interested in File Allocation Tables,
I read my compiler documentation to find nonstandard functions
which dealt with the topic.
I don't recall anything about the topic,
which would suggest that there was an embedded aspect to it.


We use the FAT file system often times in embedded systems, therefore we
need to know how it works and how to implement it. Thus, we'd be more than
happy to explain it to someone over there.

--
- Mark ->
--
Nov 14 '05 #8
>I am intermediate in C programming, basically I programmed in Unix for
digital signal processing...

Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia
card...I can view the raw data in WinHex...now what I want is, in generic C
codes to read all the data
I see in WinHex...


On some systems, a smartmedia card connected through a USB card
reader shows up in the system as a 'umass' device and a virtual
disk drive. Mount it (assuming the system requires mounting: UNIX
does, Windows doesn't). Access it as though it were a filesystem
on a hard disk (using appropriate file names for the files on the
flash card). You need to use system-specific functions to determine
that it is *NOT* a hard disk.

If you want to see the whole filesystem image, in UNIX you can
use the device name for the virtual disk partition. From there,
feed it to fopen(), open as a binary file, and read data as needed.
I'm not sure how you do that in Windows.

Gordon L. Burditt
Nov 14 '05 #9
Thank you all for your replies! Basically I have some clue now.
I will use WinHex to save my entire Smartmedia image into a mega-file...
Then I will open the mega-file in binary access mode...
And I will write some C codes to implement how to read/write (extract
actually) files
to/from this mega-file. That is all programming all about.

Eventually I will write assembly code or use FPGA to interface directly to
my Smartmedia
and do something fun with it...

Do I sound logical?

Best Regards,
Kelvin


"Kelvin @ SG" <ke********@hotmail.com> wrote in message
news:c0**********@reader01.singnet.com.sg...
Hi, group:

I am intermediate in C programming, basically I programmed in Unix for
digital signal processing...

Now I need to write a C++ program to read/write the whole volume of a FAT
formatted smartmedia
card...I can view the raw data in WinHex...now what I want is, in generic C codes to read all the data
I see in WinHex...

Could anybody teach me on how to handle this kind of work? Any websites are welcome.

Best Regards,
Kelvin

Nov 14 '05 #10

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

Similar topics

9
by: Kelvin | last post by:
Hi, group: I am intermediate in C programming, basically I programmed in Unix for digital signal processing... Now I need to write a C++ program to read/write the whole volume of a FAT...
3
by: Vandana Rola | last post by:
Hi Everyone, Description: I have created flash cards using html layers, jpegs, and javascript. The way I designed it is, I have words and their descriptions (meaning) as jpeg files. Each word...
2
by: Robbie | last post by:
As info, the flash card is not showing up as a drive letter.
1
by: Tito | last post by:
For an internet telephone application, I need to be able to read and write data to and from /dev/dsp simultaneously. I wrote some code and its not working. Anyone have any working code to do...
0
by: tekeste | last post by:
I have NEC Mobile Pro 900. I can not use it with any of my usb flash drive, and network card.it's windows Ce .net 4.0 running on it. would you please tell me where I can find usb flash disk and...
2
by: Kevin Ar18 | last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230 I have a zip file that is several GB in size, and one of the files inside of it...
9
by: vineeth | last post by:
Hello all, I have come across a weird problem, I need to determine the amount of bytes read from a file, but couldn't figure it out , My program does this : __ file = open("somefile") data =...
70
by: quickcur | last post by:
hi can anyone explain me to read image to memory from a url it is very easy in java but it is hard to find an complete solution in c/c++. Thanks,
8
by: Salad | last post by:
I was asked to get my daughter a flash drive. She needs to use it to copy files to it so she can transfer the files at school to her desktop at home. I've never used one but I figure some of...
4
by: rsgalloway | last post by:
I'm trying to save an image from a Flash AS3 to my server as a jpg file. I found some PHP code to do this, but I want to do this in Python. I'm not quite sure how to convert the following code to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.