home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_06_02
/
v6n2011b.txt
< prev
next >
Wrap
Text File
|
1989-09-28
|
607b
|
25 lines
/* Define the record */
#define SIZE_A 10
/* Max size of string including the NUL terminator */
struct s_record
{
char a[SIZE_A];
int xx;
...
};
struct s_record record;
int record_number;
/* Write a record */
record_number = 12;
fseek(file,(long) RECORD_SIZE * record_number, 0);
fwrite(&record,RECORD_SIZE,1,file);
/* Read a record */
record_number = 12;
fseek(file,(long) RECORD_SIZE * record_number, 0);
fread(&record,RECORD_SIZE,1,file);