1
I can open and go through the entire file the error happens when I try to point to the beginning or end of the queue, someone tell me if the pointers are correct
typedef struct lista {
int info;
char infoP;
struct lista* prox;
}Lista;
typedef struct fila {
Lista* ini;
Lista* fim;
}Fila;
void fila_insere (Fila* f)
{
Lista* n = (Lista*) malloc(sizeof(Lista));
n->prox = NULL;
FILE *Arquivo;
Arquivo = fopen("..\\senha.txt", "r");
do
{
n->info = getc(Arquivo);
if(Arquivo == 0)
{
printf("Erro na abertura do arquivo");
fclose(Arquivo);
}
else
{
if( n->info != '\n' && n->info != EOF)
{
if(lst_vazia(f))
{
f->fim->prox = n;
}
else
{
f->ini = n;
}
f->fim = n;
}
}
}
while (n->info != EOF);
}
Example of file the program will read
1
2
3
4
Your question has some problems: 1) The code is incomplete and with indentation difficult to read 2) You didn’t say clearly what is the error you are having 3) You didn’t make clear what was the expected behavior of the program.
– hugomg