Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef struct {
- char lname[16];
- char fname[24];
- char mi;
- }Nametype;
- typedef struct {
- Nametype name;
- unsigned int ID;
- char course[8];
- int yrlvl;
- }Studtype;
- void displayStud(Studtype stud);
- int main (void){
- Studtype studs[5] = { { { "Detablan", "Paul", 'M'}, 11111111, "BSCS", 1},
- { { "Monsalud", "Liv", 'B'}, 11111111, "BSCS", 1},
- { { "Dejito", "Christine", 'P'}, 11111111, "BSCS", 1},
- { { "Antonio", "Justin", 'M'}, 11111111, "BSCS", 1},
- { { "Quitayen", "Moises", 'X'}, 11111111, "BSCS", 1} };
- FILE *fp;
- char filename[16];
- int x;
- for(x=0;x<num;x++){
- displayStud(studs[x]);
- }
- printf("\nEnter the name of the file: "); scanf("%s", filename);
- // createFile.c Program
- fp = fopen(filename, "w");
- if(fp == NULL){
- printf("\nUnsuccessful in opening %s", filename);
- }else{
- fwrite(stud, sizeof(Studtype), 1, fp);
- fclose(fp);
- }
- return 0;
- }
- void displayStud(Studtype S){
- printf("%")
- }
- //readFile.c Program
- /*
- printf("\nEnter the name of the file: "); scanf("%s", filename);
- // createFile.c Program
- fp = fopen(filename, "r");
- while (fread(&S, sizeof(S), 1, fp) != 0){
- displayStud(S);
- }
- fclose(fp);
- void displayStud(Studtype S){
- }*/
- //writeFile.c Program
- /*int num = sizeof(studs)sizeof(stud[0]);*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement