468,457 Members | 1,598 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

Handling large records in C

Pls tell how to handle large records in C using files .The records contain name, code, address etc,......
Sep 25 '06 #1
8 3919
Banfa
9,051 Expert Mod 8TB
The question is not really clear, create a structure for each record.
Sep 25 '06 #2
pls provide some related code
Sep 25 '06 #3
Banfa
9,051 Expert Mod 8TB
pls provide some related code
Expand|Select|Wrap|Line Numbers
  1. struct record {
  2.     char name[MAXNAME];
  3.     unsigned code;
  4.     char address[MAXADDRESS];
  5. };
  6.  
Sep 25 '06 #4
pls tell how to write info in file. Thanks
Sep 25 '06 #5
Banfa
9,051 Expert Mod 8TB
pls tell how to write info in file. Thanks
look up the functions

fopen
fclose
fread
fwrite
Sep 25 '06 #6
Thanks
But problem is that the fread and fwrite are fro binary files.
I want to write the infromation in the following format in text files:
Record-1 Name Age .......
Record-2..

Pls check
Sep 26 '06 #7
pls check how to write in text file and read the same form text file and with proper formatting,
Sep 27 '06 #8
Banfa
9,051 Expert Mod 8TB
Thanks
But problem is that the fread and fwrite are fro binary files.
I want to write the infromation in the following format in text files:
Record-1 Name Age .......
Record-2..

Pls check
In that case look up

fputs
fprintf

Just because fread and fwrite are for binary data doesn't stop you using them to write text. text is binary data too as far as the computer is concerned it is just you that chooses to view it differently.
Sep 27 '06 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by =?Utf-8?B?TW9iaWxlTWFu?= | last post: by
2 posts views Thread by =?Utf-8?B?UHJpeWE=?= | last post: by
9 posts views Thread by pargat.singh | last post: by
25 posts views Thread by tekctrl | last post: by
2 posts views Thread by nguyenminhhai | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.