Changing to ASCII......

S

swetha

HI Every1,
I have a file in binary format. Using a C program
i
have to read that file and need to make some changes . So i wanted to
convert that into ACII format.Can any1 suggest me how to do that
please.....

ADDING TO IT .....

The file i have is a data file(in binary mode) which consists of
structures of type say --

struct tab {
char name;
int value;
} ; I have to write a C program which searches this file with the
name given by the user and returns or updates the value field of that
particular user.....
 
S

santosh

swetha said:
HI Every1,
I have a file in binary format. Using a C program
i
have to read that file and need to make some changes . So i wanted to
convert that into ACII format.Can any1 suggest me how to do that
please.....

ADDING TO IT .....

The file i have is a data file(in binary mode) which consists of
structures of type say --

struct tab {
char name;

Are you sure of the above declaration? 'name' can hold only a single
character of the source or execution character set. Perhaps 'name' is
an array, which would be more appropriate to hold a name of a person or
other object?
int value;
} ; I have to write a C program which searches this file with the
name given by the user and returns or updates the value field of that
particular user.....

First you have to decide whether you want to do the search as you read
from the stream (aka file) or whether you would prefer to read the
whole file, or a part of it, into memory (presumably into an array of
struct tab objects), before searching. If you will be performing many
searches, reading from memory is much better than reading a stream,
though the implementation's buffering may ameliorate matters.

In anycase the strcmp() and strncmp() functions should be useful. You
library should be having documentation for them. If not, look here:

<http://www.dinkumware.com/manuals/>

Post your attempt if you have further problems. We don't do your
homework for you.
 
K

karthikbalaguru

HI Every1,
I have a file in binary format. Using a C program
i
have to read that file and need to make some changes . So i wanted to
convert that into ACII format.Can any1 suggest me how to do that
please.....

ADDING TO IT .....

The file i have is a data file(in binary mode) which consists of
structures of type say --

struct tab {
char name;
int value;} ; I have to write a C program which searches this file with the

name given by the user and returns or updates the value field of that
particular user.....

Few design logics together with
string functions should help you.

Karthik Balaguru
 
S

Sheth Raxit

HI Every1,
I have a file in binary format. Using a C program
i
have to read that file and need to make some changes . So i wanted to
convert that into ACII format.Can any1 suggest me how to do that
please.....

ADDING TO IT .....

The file i have is a data file(in binary mode) which consists of
structures of type say --

struct tab {
char name;
int value;} ; I have to write a C program which searches this file with the

name given by the user and returns or updates the value field of that
particular user.....

refer man page of fopen, fread, fwrite and fclose.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top