Boa noite galera estou com uma duvida e que esta ocasionando um problema estou do 2º semestre do curso de analise e desenvolvimento de sistemas, porem estou com o seguinte problema, estou com um trabalho que vai ficar no lugar das provas finais, vamos ao problema meu codigo esta praticamente pronto porem ele não esta salvando as informações no arquivo dat ou txt, ele cria o arquivo porem não salva segue abaixo o codigo desde já agradeço void cadprof(){
char num[4],op;
system("cls");//APAGA TUDO//
if((fopen("professor.dat","a+b")) == 0){
printf("Não foi possivel Abrir");
}do{
tabfunc("Cadastro de Professor(a):");
textcolor(LIGHT_CYAN);
gotoxy(9,5);
gets(num);
p1.id=atoi(num);
gotoxy(19,5);
fflush(stdin);
gets(p1.nome);
gotoxy(13,7);
fflush(stdin);
gets(p1.sobrenome);
gotoxy(44,5);
fflush(stdin);
gets(p1.rg);
gotoxy(47,7);
fflush(stdin);
gets(p1.senha);
gotoxy(7,9);
fflush(stdin);
gets(p1.cpf);
gotoxy(48,9);
fflush(stdin);
gets(p1.funcao);
gotoxy(12,11);
fflush(stdin);
gets(p1.end);
gotoxy(48,11);
fflush(stdin);
gets(p1.bai);
gotoxy(10,13);
fflush(stdin);
gets(p1.cid);
gotoxy(45,13);
fflush(stdin);
gets(p1.cep);
gotoxy(12,15);
fflush(stdin);
gets(p1.tel);
gotoxy(50,15);
fflush(stdin);
gets(p1.cel);
gotoxy(16,17);
fflush(stdin);
gets(p1.datnas);
fwrite(&p1, sizeof(p1),1, ponteiro);
printf("\n");
printf("%c",201); //ESCREVE UM SIMBOLO DA TABELA ASCII//
for(cont=0;cont<78;cont++)//INICIO DE UM LAÇO PARA: CONTADOR COMEÇA COM 0;CONT MENOR QUE 79(Nº DE ESPAÇOS NA TELA//
printf("%c",205); //ESCREVE UM SIMBOLO DA TABELA ASCII ATE O LAÇO ACABAR//
printf("%c",187); //ESCREVE OUTRO SIMBOLO//
for(con=0;con<2;con++){
printf("%c",186); //ESCREVE UM SIMBOLO DA TABELA ASCII//
for(cont=0;cont<78;cont++)//COMEÇO DO LAÇO PARA PARA PULAR UMA LINHA//
printf(" ");//ESCREVE UM ESPAÇO EM BRANCO ATE O LAÇO ACABAR//
printf("%c",186);//ESCREVE UM SIMBOLO DA TABELA ASCII//
}
gotoxy(2,18);
printf("Novo Cadastro(n) Sair(ESC)");
do{
fflush(stdin);
op=getch();
if(op!='n'||op!=(char)27)
printf("Opcao Invalida");
}while(op!='n' && op!=ESC);
backcolor(BLACK);
}while(op!=ESC);
}