Search:

Type: Posts; User: wiqxlzxsxj

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    5,208

    Thank u

    Thank u
  2. Replies
    2
    Views
    5,208

    SOLVED: strtok() and original string

    I want to look at the problem of tokenizing a string. Calling strtok() changes the original string by placing '\0' in lieu of the tokens. I was wondering if there was a trick to avoid this. I want to...
  3. Replies
    12
    Views
    8,685

    The printf family of functions work perfectly in...

    The printf family of functions work perfectly in my example and are legible to read. They are "the standard" way to implement io/manipulate strings.
    I'm looking for a more direct way to just print...
  4. Replies
    12
    Views
    8,685

    No .

    No .
  5. Replies
    12
    Views
    8,685

    Yes this is what I want.

    Yes this is what I want.
  6. Replies
    12
    Views
    8,685

    What is fwrite() doing? It's outputting the...

    What is fwrite() doing? It's outputting the contents at &f in its binary form to stdout. Seems I need another operation to do the actual conversion to a type float. My bad...

    Now it gets worse....
  7. Replies
    12
    Views
    8,685

    I was looking to not use printf family of...

    I was looking to not use printf family of functions.
    Curious though why doesn't fwrite() work in this example? This is what a few tutorials show how to use fwrite().
  8. Replies
    12
    Views
    8,685

    f-write stdout

    I have this little program. It outputs the binary conversion to the console (aka garbled output). Is there a way to fwrite() numerical types to the output?


    #include int main()
    {
    float...
  9. Replies
    6
    Views
    5,188

    The correct term is "Flexible array member" for...

    The correct term is "Flexible array member" for the data field in the struct. Feature introduced in C99.
  10. Replies
    6
    Views
    5,188

    Yes that is what I was trying to do. Thanks!...

    Yes that is what I was trying to do. Thanks!
    Though I also managed to work it out using two mallocs for the list and then calling realloc on list->data alone.



    List *list = malloc(sizeof...
  11. Replies
    6
    Views
    5,188

    Well, just realized that the static size_t vars...

    Well, just realized that the static size_t vars in the struct are anchoring the struct down from dynamic reallocation. The allocation occurs but then it overflows its neighbors as a result thus...
  12. Replies
    6
    Views
    5,188

    If I add elements to the block before that...

    If I add elements to the block before that realloc, memcpy works fine.
  13. Replies
    6
    Views
    5,188

    Elastic array block with malloc realloc

    I'm trying to implement a dynamic array using a struct:



    typedef struct
    {
    size_t count, el_size, alloc_count;
    void *data;
    } List;
  14. The problem was clearly outlined in the first...

    The problem was clearly outlined in the first post.
    qsort() sorts array, arrays of structs, but it won't sort "anything". For example lists. Instead of trying to fudge this problem I implemented my...
  15. With all due respect I am not your apprentice. If...

    With all due respect I am not your apprentice. If you consider yourself to be in a teaching position then all you've done is to suggest workarounds to the original problem. This isn't an exercise to...
  16. How is this at all related to the original...

    How is this at all related to the original question? You could work around to fit in qsort(). But that isn't the priority here!
  17. There is plenty of evidence of retardation in...

    There is plenty of evidence of retardation in this thread already.
  18. qsort is part of the C std. lib. It doesn't use...

    qsort is part of the C std. lib.
    It doesn't use malloc(). It uses a similar type approach I described above.
    I would prefer to reuse a pre-existing library if I could. But I am not using qsort...
  19. For an embedded application (or for any...

    For an embedded application (or for any application for that matter) you have to make predetermined assumptions about variable sizes. For example fixed char sizes to store strings etc, which my...
  20. Point is, I want to leave scratch as arbitrary...

    Point is, I want to leave scratch as arbitrary storage variable instead of assuming to cast it as data from the outset.
  21. Storing data in an arbitrarily large data type on the stack

    I have a struct of doubles like so:


    struct data
    {
    double x;
    double y;
    double z;
    } data;
  22. OK that's a fair enough explanation I was looking...

    OK that's a fair enough explanation I was looking for. In terms of the assembly instructions, an int will always be an int.
  23. I am asking if printf will segfault? But by...

    I am asking if printf will segfault? But by atomic I am referring to atomicity of a given operation in each mutually exclusive thread. So if X is being changed in the other thread and at the same,...
  24. I have already debugged the problem and the...

    I have already debugged the problem and the problem lies somewhere in the ncurses (wprintw) implementation that I have done. Basically there are variables being updated in another thread and the...
  25. Printing variables safely using printf, wprintw

    I was interested to know if there is any process already in place to check variables when printing them using printf or wprintw.

    Here is the scenario. There are variables being changed and altered...
Results 1 to 25 of 44
Page 1 of 2 1 2