471,058 Members | 953 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,058 software developers and data experts.

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 3991
Banfa
9,065 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,065 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,065 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,065 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
reply views Thread by leo001 | last post: by

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.