Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Changing to ASCII......

Reply
Thread Tools

Changing to ASCII......

 
 
swetha
Guest
Posts: n/a
 
      11-19-2007
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.....
 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      11-19-2007
In article
<9672e62e-9c04-44e5-8494->,
swetha <> wrote on Monday 19 Nov 2007 11:40 am:

> 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.

 
Reply With Quote
 
 
 
 
karthikbalaguru
Guest
Posts: n/a
 
      11-19-2007
On Nov 19, 11:10 am, swetha <laptop...@gmail.com> wrote:
> 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
 
Reply With Quote
 
Sheth Raxit
Guest
Posts: n/a
 
      11-19-2007
On Nov 19, 11:10 am, swetha <laptop...@gmail.com> wrote:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing style of the numbers in a CSS <ol> without changing the style of the <li> Aaron Beall HTML 2 09-14-2007 08:07 PM
<FAQENTRY>I'm changing my page but nothing is changing on the screen. Why?</FAQENTRY> VK Javascript 3 03-15-2007 04:59 PM
Guide: Changing your Power Supply fan RObErT_RaTh Reviews & How-To's 0 08-24-2005 04:05 PM
changing file extension without changing filename jamy Computer Support 4 03-04-2005 01:03 AM
Difficulty in changing the Connection Server control path changing ... Samridhi Kumar Shukla ASP .Net 1 11-30-2003 02:31 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57