Search:

Type: Posts; User: TalosChen

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    7
    Views
    2,967

    I'm really sorry for this thread, because it's...

    I'm really sorry for this thread, because it's not the realloc()'s fault but mine. I actually use the shorter size for realloc() but not the longer which I respect, so the problem has been solved....
  2. Replies
    7
    Views
    2,967

    Well, how can memory pool be corrupted? free,...

    Well, how can memory pool be corrupted?

    free, malloc, realloc or something like this?
  3. Replies
    7
    Views
    2,967

    Sorry, my program is large. So I cannot give you...

    Sorry, my program is large. So I cannot give you such code to run for test. But I did write a small test program to test realloc(), and nothing abnormal happened.
  4. Replies
    7
    Views
    2,967

    for example, before realloc() msg_in_all,...

    for example,

    before realloc()


    msg_in_all, len: 111, addr: 009C1960
    01000029 0301446D 6B1D278D 11AE381E 01000029 0301446D 6B1D278D 11AE381E
    FB49D271 EA2D0F36 F97B8E85 EFA0AA64 B5117225...
  5. Replies
    7
    Views
    2,967

    realloc() doesnt copy the block correctly!

    I remembered that when you call realloc() and the return address is different from the original one, then realloc() should copy the content of the original block to the newly allocated block. But in...
  6. Replies
    5
    Views
    1,555

    Thanks. I've always learned much here.

    Thanks. I've always learned much here.
  7. Replies
    5
    Views
    1,555

    question about free()

    Can I free a pointer several times?
    Or, can I free a pointer if I don't know whether it has been freed?
  8. Thread: Question?

    by TalosChen
    Replies
    4
    Views
    1,380

    MSDN is just reference, it cannot replace a good...

    MSDN is just reference, it cannot replace a good book. My suggestion is, reading a really good book at beginning will make things much easier.
  9. Thread: Question?

    by TalosChen
    Replies
    4
    Views
    1,380

    Sams Teach Yourself C# in 21 Days, a good book...

    Sams Teach Yourself C# in 21 Days, a good book for beginners, even newbie to programming.

    And Professional C#, a very useful reference book for C# programmers. It almost covers every aspects you...
  10. Replies
    11
    Views
    1,899

    :-) I know that. It's just an example to explain...

    :-) I know that. It's just an example to explain my question.
  11. Replies
    14
    Views
    4,880

    Can somebody be kind enough to recommand some...

    Can somebody be kind enough to recommand some good timer tutorials (about how to implement, not to use) to me?
  12. Replies
    11
    Views
    1,899

    Thanks any way.

    Thanks any way.
  13. Replies
    11
    Views
    1,899

    No, what I mean is, giving you a pointer ptr,...

    No, what I mean is, giving you a pointer ptr, then can you know that if the memory pointed by ptr was once allocated by using malloc(), realloc(), etc. ? For example,


    char *ptr1 = &'a';
    char...
  14. Replies
    11
    Views
    1,899

    thanks. BTW, is there any function can figure...

    thanks.

    BTW, is there any function can figure out that if a pointer is allocated any memory?
  15. Replies
    11
    Views
    1,899

    -> Yes. No. Is Yes said that ptr2 != ptr1...

    -> Yes. No.

    Is Yes said that ptr2 != ptr1 maybe true, and No said that I need not free(ptr1) if it's no longer used?
  16. Replies
    11
    Views
    1,899

    questions about realloc()

    char *ptr1, *ptr2;
    ptr1 = (char *)malloc(m);
    ptr2 = ptr1;
    ptr2 = (char *)realloc(ptr1, n); // n > m


    ptr2 could be different from ptr1 after realloc(), in that case, should I free(ptr1)?
  17. Replies
    160
    Views
    1,232,083

    Sticky: Useful and funny, that's one of the best...

    Useful and funny, that's one of the best technique book I've ever seen!

    Another book, C Traps and Pitfalls by Andrew Koenig.
    Abstract of this book,
    "The C language is like a carving knife:...
  18. Replies
    6
    Views
    1,829

    In Windows, there are actually two chars at the...

    In Windows, there are actually two chars at the end of a line: \xD and \xA. Note, they exist only in text files. But in *nix, only one: \xA. So you can open a.txt with binary mode, and read a line by...
  19. Replies
    3
    Views
    1,783

    CategoryType is just NAME of a type, you should...

    CategoryType is just NAME of a type, you should use:

    currentItem = currentCat->headItem;

    replace the currentCat with any pointer you want to really use.
  20. Replies
    14
    Views
    4,880

    The actual problem is already solved by using...

    The actual problem is already solved by using select(). But I still wanna know how to implement such a timer that I described. I'm really interesting about it.
  21. Replies
    2
    Views
    1,560

    array name is unmodifiable, so you should use...

    array name is unmodifiable, so you should use another pointer that points to "splitbuf".
  22. Replies
    4
    Views
    1,048

    merge two files, or make two types in one file.

    merge two files, or make two types in one file.
  23. Replies
    14
    Views
    4,880

    Agree. That's the essence of the problem, what if...

    Agree. That's the essence of the problem, what if the function never returns? I think another thread will be needed, but that complicates the problem and a lot should be learned by me. So is there...
  24. Replies
    14
    Views
    4,880

    But if in general, how can I implement a timeout...

    But if in general, how can I implement a timeout timer or something else?
  25. Replies
    14
    Views
    4,880

    Sorry, there's one thing that I forgot to say,...

    Sorry, there's one thing that I forgot to say, that is, I dont wanna a WAIT timer. What I really need is a TIMEOUT timer. For example, the socket function recv(). When it works in block mode, I want...
Results 1 to 25 of 28
Page 1 of 2 1 2