Output does not appear in program C [duplicate]

0
    

This question already has an answer here:

    

Hello, I have a C code that annotates, deletes, or lists students in a text document. He asks what I want to do. But when I type the letter of one of the options, nothing happens!

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NULO '
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NULO '%pre%'
void removerLinha(int numOfLinha, FILE *arquivo){
    int line = 1;
    char content[90];
    rewind(arquivo);
    for(int i = 0; !feof(arquivo);i++){ 
    memset(arquivo, NULO, 100); 
    fgets(content, 101, arquivo); 
    fputc('\n', arquivo); 
    line = line + 1; 
    continue; 
    }
    line = line + 1;
}   

int main(void){
    int numeroDelete;
    FILE *log;
    char nome[75];
    char opcao;
    char ch;
    printf("O que voce deseja fazer?\n\n");
    printf("(N) Novo Aluno\n");
    printf("(D) Exluir Aluno\n");
    printf("(L) Listar Alunos\n");
    scanf("%c", opcao);
    if(opcao == 'n' || opcao == 'N'){
        printf("Nome do Aluno:\n ");
        scanf("%[^\n]", &nome );
        if(!log){
        log = fopen("log.txt", "w+");
        fprintf(log, "1: %[^\n]\n", nome);
        fclose(log);
    }else{
        log = fopen("log.txt", "r+");
        fprintf(log, "%[^\n]\n", nome);
        fclose(log);
    }
    }if(opcao == 'd' || opcao == 'D'){
    printf("Numero da linha a ser apagada: ");
    scanf("%d", numeroDelete);
    removerLinha(numeroDelete, log);
    }if(opcao == 'l' || opcao == 'L'){
        while( (ch=fgetc(log))!= EOF ){
            printf("%[^\n]", ch);
        }

    }
}
' void removerLinha(int numOfLinha, FILE *arquivo){ int line = 1; char content[90]; rewind(arquivo); for(int i = 0; !feof(arquivo);i++){ memset(arquivo, NULO, 100); fgets(content, 101, arquivo); fputc('\n', arquivo); line = line + 1; continue; } line = line + 1; } int main(void){ int numeroDelete; FILE *log; char nome[75]; char opcao; char ch; printf("O que voce deseja fazer?\n\n"); printf("(N) Novo Aluno\n"); printf("(D) Exluir Aluno\n"); printf("(L) Listar Alunos\n"); scanf("%c", opcao); if(opcao == 'n' || opcao == 'N'){ printf("Nome do Aluno:\n "); scanf("%[^\n]", &nome ); if(!log){ log = fopen("log.txt", "w+"); fprintf(log, "1: %[^\n]\n", nome); fclose(log); }else{ log = fopen("log.txt", "r+"); fprintf(log, "%[^\n]\n", nome); fclose(log); } }if(opcao == 'd' || opcao == 'D'){ printf("Numero da linha a ser apagada: "); scanf("%d", numeroDelete); removerLinha(numeroDelete, log); }if(opcao == 'l' || opcao == 'L'){ while( (ch=fgetc(log))!= EOF ){ printf("%[^\n]", ch); } } }
    
asked by anonymous 16.11.2018 / 15:45

1 answer

-1

You forgot the "&" character to address the entry, in the first scanf. What's more, there are more snippets of code with the same problem.

    
16.11.2018 / 15:51