Search:

Type: Posts; User: Dedalus

Search: Search took 0.01 seconds.

  1. Replies
    17
    Views
    5,019

    Hi I finally got the error. It was in how...

    Hi

    I finally got the error.
    It was in how gdb was started, I always did:


    gdb test

    and then inside gdb
  2. Replies
    17
    Views
    5,019

    It is not mistery at all. I don't think I'm...

    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:
  3. Replies
    17
    Views
    5,019

    Yea buf contains a '\n' so gdb should not...

    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
  4. Replies
    17
    Views
    5,019

    That's what I thought but I used a test file...

    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...
  5. Replies
    17
    Views
    5,019

    Hi I wanted to tell that I found how to avoid the...

    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
  6. Replies
    17
    Views
    5,019

    Hi no actually I read it in buf and then I...

    Hi
    no actually I read it in buf and then I directly look for the '\n'.
  7. Replies
    17
    Views
    5,019

    Yea you right, but the problem is that the...

    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'?
  8. Replies
    17
    Views
    5,019

    Hi Salem thx for your feedback it's really weird....

    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:

    ...
  9. Replies
    17
    Views
    5,019

    Hi thx for reply here details: I include ...

    Hi thx for reply

    here details:
    I include


    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
  10. Replies
    17
    Views
    5,019

    Segfault on dynamic allocation

    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...
Results 1 to 10 of 10