Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- struct clientData
- {
- int accountNum;
- char lastName[15];
- char firstName[10];
- double balance;
- };
- int main (void){
- FILE *cfPtr;
- int i;
- struct clientData client = {0, "", "", 0.0};
- if ((cfPtr=fopen("credit.dat", "wb")) == NULL){
- printf("File couled not be opened\n");
- }
- else {
- for(i=0;i<100;i++){
- printf("Initializing accountno %d\n",i);
- client.accountNum=i+1;
- fwrite(&client, sizeof (struct clientData), 1, cfPtr);
- }
- fclose(cfPtr);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement