Questions tagged as 'fgets'

2
answers

fgets () returns NULL when reading text file

When I try to read my FILE fpTextFixed ( fgets(line,sizeof(line),fpTextFixed) ), it returned me NULL , but it was corroborating and my file was opened and written correctly. What I'm trying to do is write a binary file from re...
asked by 23.09.2016 / 03:00
2
answers

I can not clean the keyboard buffer in C

In my code, I request a series of data from the user using the gets() function. The problem is that at a certain point in the program when requesting a data with gets() it simply jumps to the next request and leaves the variable bl...
asked by 14.07.2016 / 03:01
1
answer

Creating my "mini shell" - Error: Segmentation Fault

I am developing a mini shell for a university practice and I run into an error that I have not been able to solve since according to what I have understood, searching in Google for my error, it is an error that can come out of several causes. Le...
asked by 09.11.2016 / 14:50
1
answer

Delete line break when using fgets in c

when reading a string of characters with fgets, this also saves the line break (\ n), how can I delete that line break using fgets anyway to read? It does not help me to use fscanf or another format to read Thanks.     
asked by 20.06.2017 / 00:27
2
answers

Read line of text file with fixed format

I'm not sure which is the best way to read The following text file which was generated in the following way: Struct int nro_orden; char desc[30]; int cantidad; fprintf(pf,"%03d%-30s%03d\n",pedido[i].nro_orden,pedido[i].desc,pedido[i].cant...
asked by 16.07.2018 / 00:12