Search:

Type: Posts; User: Alexander Edgar

Search: Search took 0.00 seconds.

  1. Replies
    10
    Views
    3,643

    I guess the best way to do that in C would be to...

    I guess the best way to do that in C would be to read the entire line, separate spaces with strtok, and then read only the first letter of each token.

    Back to my original question though - how do...
  2. Replies
    10
    Views
    3,643

    Oops! T.T. I think this would work the way I want...

    Oops! T.T. I think this would work the way I want but I haven't tried it:


    char v[2];
    scanf("%[^' '] %c", &v[0], &v[1]);


    Anyway that just further verifies I need to learn to do this, lol
  3. Replies
    10
    Views
    3,643

    Sorry about the wrong thingamajigs and the lack...

    Sorry about the wrong thingamajigs and the lack of proper description. That was just example code to quickly show what I'm looking for.

    What I'm actually doing is a loop on both x and y and I...
  4. Replies
    10
    Views
    3,643

    Equivalent of sscanf

    I'm transitioning from C to C++ and am apparently having issues with certain things. In my C code, I have something that looks like this:



    char grid[2][2];
    for(int y=0; y<2; y++)
    {
    ...
  5. Replies
    1
    Views
    6,002

    Simple Color Picker with glReadPixel

    I'm trying to read the pixel at the user's cursor when they right click on a triangular gradient, but glReadPixel is only returning black. If I make it a flat color instead of a gradient, it works,...
  6. Ah! That makes sense, thank you very much. As...

    Ah! That makes sense, thank you very much.

    As a kind of follow up - if I was going to try to send the same data over a network, how would the server/client know that it's receiving a cMap...
  7. Error-checking a class read from a binary file

    I'm writing a certain class (the specifics don't really pertain to my question) to a file like so



    fwrite((void*)&Map[MapID], sizeof(cMap), 1, fp);


    And I read it later like so
  8. Does __attribute__ ((destructor)) run on crash?

    Will gcc's deconstructor still run if the program crashes (due to a segfault or whatever else), or only on a successful exit or end of main?
  9. Replies
    8
    Views
    8,565

    Thanks whiteflags, that worked! Also, in regards...

    Thanks whiteflags, that worked! Also, in regards to iMalc: Would the right way to use realloc look something like this?



    if(ID == -1)
    {
    ID = numInterfaces;
    cInterface* newface =...
  10. Replies
    8
    Views
    8,565

    So I switched to new and delete, but I didn't...

    So I switched to new and delete, but I didn't find a good replacement for realloc. Is there a way to do something similar without having to rewrite my entire program to use std::vector? I tried using...
  11. Replies
    8
    Views
    8,565

    std::string.assign segfault

    I use a std::string inside of a class I allocate dynamically, and I crash or get segfaults whenever I try to use the string. I assume I'm not initializing it right somehow, but I don't know what to...
  12. TTF_Font to GL Display List Kerning issue

    Forgot to mention that although the font looks like it has an outline, that's just part of the font. The actual true-type font looks like that, haha. Also, I can end up with it looking like this...
Results 1 to 12 of 12