-1
I would like to know how to do after adding it() just returned to the menu. Someone helps?
#include <stdio.h>
#include <stdlib.h>
char descricao[40];
void adicionar(){
FILE * pFile;
printf("ESCREVA: ");
fgets (descricao,39,stdin);
pFile = fopen ("log.txt","a");
fputs (descricao,pFile);
fclose (pFile);
fflush(stdin);
getchar();
}
void menu(){
int opcao;
while (1){
puts("1... Adicionar artigo");
puts("2... Sair");
scanf("%d", &opcao);
switch (opcao){
case 1:
adicionar();
break;
case 2:
exit(0);
}
}
}
int main(){
menu();
}
Is there a problem? It seems to be all right.
– Maniero