Search:

Type: Posts; User: dwks

Page 1 of 20 1 2 3 4

Search: Search took 0.10 seconds.

  1. You're converting numbers to strings and...

    You're converting numbers to strings and concatenating two of them together, then comparing strings; that's a pretty strange way to test whether some numbers are the same. Since you're summing up...
  2. You may find it useful to store the numbers...

    You may find it useful to store the numbers you've read so far in an array, then search the array to see if the user has entered any duplicates. The getch() and clrscr() functions are non-standard...
  3. Replies
    3
    Views
    4,865

    Great links so far! What I'm going to say is all...

    Great links so far! What I'm going to say is all Linux specific, but here we go. Object files (.o) created by the compiler, executable files created by the linker, and shared libraries (.so) are all...
  4. Replies
    16
    Views
    10,864

    freddie, any exception can be replaced with a...

    freddie, any exception can be replaced with a bool wasThereAnError member of a class and then checked later. I've done this refactoring myself in some cases when C++ exceptions are not supported by...
  5. When you do a dynamic memory allocation, ...

    When you do a dynamic memory allocation,

    map[1][0][0] = (int *)malloc(sizeof(int));
    if you want to then use that memory location, you must dereference the pointer. What you're doing instead...
  6. Replies
    12
    Views
    14,192

    You can use multiple threads each with an...

    You can use multiple threads each with an io_service, but asio multiplexes all asynchronous requests that you make and waits for any of them to complete. It basically adds all the file descriptors to...
  7. Replies
    12
    Views
    14,192

    The asynchronous functions wait until the...

    The asynchronous functions wait until the operation completes (data ready to read, or socket reports write has been processed) before calling the callback function. That's the point of asynchronous...
  8. Replies
    12
    Views
    14,192

    You could register a function on a timer to...

    You could register a function on a timer to handle the case where the client doesn't respond: c++ - boost asio deadline_timer - Stack Overflow

    Note that if the underlying TCP connection is...
  9. Replies
    12
    Views
    14,192

    Typically each function would execute async_read...

    Typically each function would execute async_read or async_write with the next function to be called registered as the callback. They daisy-chain together. In case of errors the error handling...
  10. Replies
    22
    Views
    3,195

    The idea is that a structure definition can...

    The idea is that a structure definition can either a) declare a new type of structure, or b) declare instance variables of a structure, or c) both. If you only want to use the structure once, you...
  11. Replies
    2
    Views
    2,556

    You're reusing the loop variable i here: ...

    You're reusing the loop variable i here:



    for (i = 0; i < s.numWidths; i += 1){
    maxWidth += s.fieldWidths[i];
    p.n = ceil(maxWidth / 32.0);
    p.fieldValues =...
  12. In most of your functions, you take a "head"...

    In most of your functions, you take a "head" pointer as a parameter to the function; then you allocate a node called temp, and set its next to NULL, and proceed to iterate through temp. Since you...
  13. Replies
    4
    Views
    8,493

    Some other comments about your code in general: ...

    Some other comments about your code in general:

    init() is a fairly common name as well, you may want to change that just to be safe. ;)
    Standard name for main()'s parameters are argc, and argv....
  14. Replies
    4
    Views
    8,493

    I used to be an expert in SDL 1.2 but I haven't...

    I used to be an expert in SDL 1.2 but I haven't touched SDL 2 yet, so I thought I'd take a look at your code. It was very puzzling, I have to say. You're getting SIGBUS or SIGSEGV whenever SDL_Quit()...
  15. Replies
    2
    Views
    1,007

    Within your outer "Print pyramid" loop, you are...

    Within your outer "Print pyramid" loop, you are printing the data for one line at a time (and ending with a "\n"). So your "Print hash" loop has to print all the #'s that are going to appear on one...
  16. Replies
    13
    Views
    3,556

    Look up fscanf()...

    Look up fscanf(), or use fgets() in combination with sscanf().
  17. Replies
    7
    Views
    2,103

    The example doesn't actually create a linked list...

    The example doesn't actually create a linked list at all. It makes a single EnemySpaceShip, then calls updateShip on that single ship. The structure does have a next pointer which is set to NULL, but...
  18. You mean, how do you include the code into your...

    You mean, how do you include the code into your project? I guess you would figure out which development environment you're using (Microsoft Visual Studio?) and search for how to add files to the...
  19. Replies
    24
    Views
    7,112

    Wrote this at the same time as killme, we're...

    Wrote this at the same time as killme, we're probably saying the same things...

    Enums can be used for returning information from a function, passing information into a function, or storing data...
  20. Thread: Snake Code Help

    by dwks
    Replies
    5
    Views
    2,639

    You're also calling SDL_Flip twice (once in main...

    You're also calling SDL_Flip twice (once in main and once at the end of make_move); I'm not sure what effect this will have. SDL_Flip is meant for when you have a hardware surface (SDL_HWSURFACE),...
  21. Actually, in C if you declare a function...

    Actually, in C if you declare a function prototype's argument list as (), this means "I don't know and I don't care what the argument list is", which is different from saying (void), which means...
  22. Thread: Solar system Help

    by dwks
    Replies
    10
    Views
    2,916

    Okay I haven't looked at what you're drawing too...

    Okay I haven't looked at what you're drawing too closely, but keep in mind that the (X,Y) coordinates reported by a glut mouse click callback are in screen coordinates, not in world (OpenGL)...
  23. Thread: G++ error

    by dwks
    Replies
    6
    Views
    2,027

    Good point. Error messages are coming from...

    Good point. Error messages are coming from "/usr/include/c++/4.6/" in the original post. Didn't notice. :)
  24. Replies
    24
    Views
    7,112

    Basically enums are to handle this, which happens...

    Basically enums are to handle this, which happens every now and then: You start with a simple variable that can be on or off, so you use a bool. Then you realize it really has a third state, so you...
  25. Thread: G++ error

    by dwks
    Replies
    6
    Views
    2,027

    Regarding flags: for starters, try -std=c++11....

    Regarding flags: for starters, try -std=c++11. That should enable lambdas.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4