0
void cadastroturma () {
char turma[30],caminho[100];
printf ("Diga o nome da turma a ser cadastrado:\n");
scanf ("%[^\n]", &turma);//Já tentei com gets e fgets
getchar();//Já tentei sem esse getchar
printf ("\nAgora o caminho onde quer gravar a turma:\n");
scanf ("%[^\n]", &caminho);
getchar();
mkdir(caminho);
strcat(strcat(strcat(caminho,"/"),turma),".coe");
printf("%s", caminho);
FILE *cadastro = fopen (caminho, "ab");
Hello, I am doing a work of the faculty of archive, this is the function of register of class, I have not put the board of students but this is not the point... The problem is that in the output, in so many ways that I have already put, the file created inside the folder either goes unnamed before the extension or is not created at all. I’ve tried even with the infamous gets() function and it didn’t work. What I want to do is enter the name of the class, then the name of the folder, create the folder and then merge the names to create the file inside the folder. Can someone help me?
The file has to be binary, no need to put the b at the end no? Anyway thanks even for the help.
– gugagom
yes you need the
b
in the end– HudsonPH