Whiteangel Posted November 26, 2015 at 10:15 AM Report Share #590100 Posted November 26, 2015 at 10:15 AM Boas pessoal, criei um registode um aluno, ele está a registar e a criar um ficheiro, mas apresenta me estes erro nos scanf que são de variáveis do tipo char, vou assinalar no codigo onde dá erro para ver se algum me consegue ajudar. typedef struct inserir_aluno{ int bi; int contacto; char nome_inserir_aluno[50]; char morada_inserir_aluno[50]; }inserir_aluno; FILE *fichinserir_alunos; inserir_aluno a; void inseririnserir_aluno() { fichinserir_alunos = fopen("inserir_alunos.txt","a+"); if (fichinserir_alunos == NULL) { printf("\nErro ao abrir o ficheiro\n"); return; } printf("Bi: "); scanf("%d", &a.bi); printf("Nome: "); scanf("%s", &a.nome_inserir_aluno);//dá erro aqui printf("Morada: "); scanf("%s", &a.morada_inserir_aluno);//dá erro aqui printf("Contacto: "); scanf("%d", &a.contacto); fwrite(&a,sizeof(inserir_aluno),1,fichinserir_alunos); printf("\ninserir_aluno %s inserido.\n",&a.nome_inserir_aluno); //dá erro aqui getchar(); fclose(fichinserir_alunos); } int main(int argc, char *argv[]) { printf("*****Inserir Alunos*****\n"); inseririnserir_aluno(); return 0; } Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted November 26, 2015 at 10:42 AM Report Share #590102 Posted November 26, 2015 at 10:42 AM retira os & IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Whiteangel Posted November 26, 2015 at 10:45 AM Author Report Share #590105 Posted November 26, 2015 at 10:45 AM retira os & Resolvida essa questão, já agora sabes porque é que me dá este alerta na funcao: Old-style function definition for 'inseririnserir_aluno'.? Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted November 26, 2015 at 10:53 AM Report Share #590107 Posted November 26, 2015 at 10:53 AM coloca um void como parâmetros da função IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now