0

Hello,i m trying to make a program that uses 2 .dat files for student managment..here's my code and the problem
main:

#include <stdlib.h>
#include <stdio.h>
#include "tei.h"

/*orismos domwn*/
struct address{
    char odos[16];
    int noumero;
};
struct foititis{
    char am[7];
    char onoma[11];
    char epitheto[16];
    struct address dieuthinsi;
    float mo;
    int fail;
};
struct mathima{
    char onoma[16];
    char am_foitith[7];
    float vathmos;
};
/*synartiseis*/
int pinakas_epilogwn();
void eisagwgh();


int main() {
int synexeia=-1;
int i;
system("cls");
while (synexeia!=0) {
synexeia=pinakas_epilogwn();
system("cls");
switch (synexeia) {
    case 1:{ eisagwgh(); break;}
   
}}}

header file:

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>

FILE *f;
 struct foititis p;



int pinakas_epilogwn()
{
int epilogi;
system("cls");
printf("\n\nP I N A K A S ---- E P I L O G O N\n\n");
printf("1. Εισαγωγή\n");
printf("2. Εκτύπωση\n");
printf("3. Διόρθωση\n");
printf("4. Διαγραφή\n");
printf("5. Ταξινόμηση\n");
printf("6. Ενημέρωση\n");
printf("7. Στατιστικά Στοιχεία \n\n");
printf("0.ΤΕΛΟΣ\n");
printf("===========================================\n");
printf("\n Επιλογή :");
scanf("%d",&epilogi);
return epilogi;
}
/* ------------------------------------------------------------- */
void eisagwgh() {
    int synexeia;
    int epilogi;
    system("cls");
printf("Eisagwgh se : \n1.Foitites.dat\nmathimata.dat");
scanf("%d",&epilogi);
switch (epilogi) {
    case 1:{

        f=fopen("Foitites.dat","r+");
if ( f ){
fseek(f,0,SEEK_END); /* Το αρχείο υπάρχει, Επέκταση */
}else{
f=fopen("Foitites.dat","w"); /* To αρχείο δεν υπάρχει, Δημιουργία */
}
        do {
printf("\nOnoma:");
scanf("%d",&p.onoma[11]);
printf("\nΕπίθετο :");
scanf("%s",&p.epitheto[16]);
printf("\nDieuthinsi");
printf("odos:");
scanf("%s",&p.dieuthinsi.odos[16]);
printf("\nnoumero:");
scanf("%f",&p.dieuthinsi.noumero);
int i=0;
p.am[16]='T0'+i++;
printf("----------------------------------------------\n");
fwrite(&p,sizeof(struct foititis),1,f);
printf("\n\nΠάτα 1 για νέα εισαγωγή - 0 για τέλος...");
scanf("%d",&synexeia);
} while (synexeia==1);
fclose(f); 


    }

}
}

and debugger:

rm -f build/Debug/GNU-Linux-x86/main.o.d
g++    -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
In file included from main.cpp:4:
tei.h:56:10: warning: multi-character character constant
In file included from main.cpp:4:
tei.h:7: error: aggregate ‘foititis p’ has incomplete type and cannot be defined
tei.h: In function ‘void eisagwgh()’:
tei.h:58: error: invalid application of ‘sizeof’ to incomplete type ‘foititis’ 
make[2]: *** [build/Debug/GNU-Linux-x86/main.o] Error 1
make[2]: Leaving directory `/home/jim/NetBeansProjects/project'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/jim/NetBeansProjects/project'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by thelamb
0

tei.h:56:10: warning: multi-character character constant

'T0' is not a character, it's two characters.

tei.h:7: error: aggregate ‘foititis p’ has incomplete type and cannot be defined

Where is 'foititis' declared? Is this declaration available in tei.h ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.