Search:

Type: Posts; User: Dedalus

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    16
    Views
    5,068

    ok guys thank you for your reply. yea I think...

    ok guys thank you for your reply.

    yea I think I'll go through printf or gdb with bt. I wanted to be sure about what is the "correct" way to do that

    Cheers
  2. Replies
    16
    Views
    5,068

    Test C code: function call order

    Hello,

    I need to test the order in which some functions are called. Other than add a prinf in each function do you know any method/tool that can help me out?

    I normally use "check unit test...
  3. Hello solved! actually I forgot to include...

    Hello

    solved!
    actually I forgot to include the stdlib.
    Moreover the int base is 10 and not 16 as I wrote

    thx for the tip
  4. Hi thx for reply. You're right atoi converts...

    Hi

    thx for reply. You're right atoi converts to integer !!
    My OS is Redhat 6 and I use gcc. I changed my code by using strtoull instead of atoi and now is better but not perfectly fine:

    ...
  5. problem while printing unsigned long long int

    Hello,

    When I try to print an unsigned long long int I get a different number displayed.
    This is the code I'm using:


    int main(int argc, char *argv[]) {

    printf ( "ULLONG_MAX: %llu\n",...
  6. Replies
    17
    Views
    4,948

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

    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:
  8. Replies
    17
    Views
    4,948

    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
  9. Replies
    17
    Views
    4,948

    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...
  10. Replies
    17
    Views
    4,948

    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
  11. Replies
    17
    Views
    4,948

    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'.
  12. Replies
    17
    Views
    4,948

    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'?
  13. Replies
    17
    Views
    4,948

    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:

    ...
  14. Replies
    17
    Views
    4,948

    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>
  15. Replies
    17
    Views
    4,948

    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...
  16. Replies
    9
    Views
    1,823

    Hi thx for the advice I see your point. So...

    Hi

    thx for the advice
    I see your point. So the cleanest way seems to be:


    int num=10;
    char *test, *tmp;
    int i=0;
  17. Replies
    9
    Views
    1,823

    Hi thx all for reply. I tried to work out a...

    Hi
    thx all for reply.
    I tried to work out a solution.
    If I would remove the first letter of a string I could then copy back the rest of the string without modify the pointer and miss the...
  18. Replies
    9
    Views
    1,823

    Hi, thx for reply.

    Hi,
    thx for reply.
  19. Replies
    9
    Views
    1,823

    free on modified pointer

    Hi,

    here there's an example code that creates a memory leak.
    My problem is to call free on modified pointer.



    int num=10;
    char *test;
    int i=0;
  20. Replies
    3
    Views
    1,478

    Hi, thanks for your help I appreciate it

    Hi,

    thanks for your help I appreciate it
  21. Replies
    3
    Views
    1,478

    malloc and free usage

    Hi all,

    I know that each time we allocate memory onto the heap (malloc, calloc, realloc..) once we finish we have to free it in order to avoid memory leaks.

    Just to improve my skills I'm...
  22. Replies
    7
    Views
    2,247

    Hello thanks for sharing your solution. I use...

    Hello

    thanks for sharing your solution.
    I use it to parse some text files, usually I use bash but wanted to try C too.

    Cheers
  23. Replies
    7
    Views
    2,247

    Hi, the method I use is a : ...

    Hi,

    the method I use is a :


    while((c=getc(stream)) != '\n'){

    so I read always the entire row

    thanks for reply
  24. Replies
    7
    Views
    2,247

    read file start from different positions

    Hi all,

    I have a file which contains some specials chars to gather one for each line. For example if the special char is $ (dollar) the file may looks like:



    hello world $ hello
    $ hello...
  25. Replies
    14
    Views
    2,263

    C sintax, underscore

    Hi all,

    Actually I'm reading some C functions, but I don't understand some notations and sintax, like:



    fputs (_("Filesystem Type"), stdout);


    for me is not clear why the develop use...
Results 1 to 25 of 56
Page 1 of 3 1 2 3