Hi
I finally got the error.
It was in how gdb was started, I always did:
gdb test
and then inside gdb
Type: Posts; User: Dedalus
Hi
I finally got the error.
It was in how gdb was started, I always did:
gdb test
and then inside gdb
It is not mistery at all. I don't think I'm hiding something
I'm posting all the infos that may needs.
Btw the file it's just 2 lines as I said,
that are:
Yea buf contains a '\n' so gdb should not complain about not finding the newline.
I mean that if (l==NULL) should not be true
That's what I thought but
I used a test file with 2 lines with '\n' at the end.
then I used a program that simply print out the line to be sure that '\n' was there.
this code
int main (int...
Hi I wanted to tell that I found how to avoid the warning.
Just change:
int word=100;
into
size_t word=100;
Moreover someone suggested me to add
Hi
no actually I read it in buf and then I directly look for the '\n'.
Yea you right,
but the problem is that the carriage ret should be there.
The input file simply contains two lines,
do you think that the problem is raised on the second line without '\n'?
Hi Salem thx for your feedback it's really weird.
When I run the code it works always even on different or big txt files without segfault.
Moreover also valgrind give me back a good result:
...
Hi thx for reply
here details:
I include
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Hi all,
I'd like to read a file line by line then remove the carriage ret and print the modified line, here's the code:
int main (int argc, char *argv[]) {
FILE *stream;
int...