Search:

Type: Posts; User: MyDoom

Search: Search took 0.00 seconds.

  1. Open the file with fopen() and use fgets() to get...

    Open the file with fopen() and use fgets() to get each line. Since the strings are separated by spaces use strtok() to tokenize them as needed.
  2. Yes, as long as the heap memory is allocated only...

    Yes, as long as the heap memory is allocated only once, it shouldn't matter, but using the new keyword at all is not an option. I found an old thread here (you also posted here, grumpy), which I...
  3. Encapsulated array - size defined by user at runtime

    I'm creating a small program for my data structures class that simulates a critical system. Thus, using heap memory is not an option, as speed is important. It's a basic stack implementation that...
  4. Replies
    4
    Views
    6,246

    You need to get the console handle for the first...

    You need to get the console handle for the first argument:

    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

    The second argument can probably be TRUE.

    Notice you need a struct for the third...
  5. Elysia, that actually doesn't work in my case (my...

    Elysia, that actually doesn't work in my case (my structures must be allocated on the heap so they don't fall out of scope). My previous post or the original *data2 = *data1; both seem to work.
  6. In case anyone is wondering how to use the...

    In case anyone is wondering how to use the compiler generated copy constructor:

    data2 = new Data(*data1);
    Of course if this one doesn't perform a deep copy of an STL container (I'm not sure at...
  7. Sorry for taking a few days to get back. ...

    Sorry for taking a few days to get back.



    This outputs 364, 364, and 3216 (both before and after the *data1 = *data2 statement). I'm using Visual Studio 2010 on Windows 7 x64, by the way.
    ...
  8. The Data struct does not hold any dynamically...

    The Data struct does not hold any dynamically allocated pointers. Thanks for the responses.
  9. Copying memory from one heap location to another

    Let's suppose I have two structs that are allocated on the heap.


    Data* data1 = new Data();
    Data* data2 = new Data();

    Later on I wish to copy data1 into data2 so that they are identical, but...
Results 1 to 9 of 9