Search:

Type: Posts; User: Prodiga1

Search: Search took 0.00 seconds.

  1. Replies
    7
    Views
    1,133

    gcount returns 0

    gcount returns 0
  2. Replies
    7
    Views
    1,133

    Those results were before the read. After the...

    Those results were before the read.

    After the read, open returns 1; good returns 0; end returns 1; and bad returns 0 (??)
  3. Replies
    7
    Views
    1,133

    myFile.is_open returns 1 myFile.good returns 1...

    myFile.is_open returns 1
    myFile.good returns 1
    myFile.eof returns 0
  4. Replies
    7
    Views
    1,133

    Reading file using ifstream

    I'm trying to read the contents of a file using the ifstream constructs. I've written a program that is a carbon copy off the website, under Reading From a File:

    C++ Binary File I/O



    1...
  5. Replies
    5
    Views
    3,165

    Thanks everyone :]

    Thanks everyone :]
  6. Replies
    5
    Views
    3,165

    Flexible Array Size / Realloc

    Hi all--

    I'm writing a program that initializes an integer double pointer to NULL, and realloc's it's size each time a particular method is called. Something like:



    int** list = NULL;
    ...
  7. Replies
    7
    Views
    1,474

    Got it. Thanks for the help, it's immensely...

    Got it. Thanks for the help, it's immensely appreciated.
  8. Replies
    7
    Views
    1,474

    That makes sense. On the same token, why is: ...

    That makes sense.

    On the same token, why is:


    1) char** stringArray = {"string1", "string2"}; //not allowed
    2) char* stringArray[] = {"string1", "string2"}; //allowed


    but
  9. Replies
    7
    Views
    1,474

    So I guess my question is: why are you allowed to...

    So I guess my question is: why are you allowed to assign a pointer to a string literal, and not a pointer of a double pointer to a string literal? (aka. char* strlit = "string" but not char**...
  10. Thread: Nested loops

    by Prodiga1
    Replies
    5
    Views
    2,604

    Think about obtaining the top section of the...

    Think about obtaining the top section of the triangle, that is:

    0
    01
    012
    0123
    01234
    012345

    How would that be accomplished?
  11. Replies
    7
    Views
    1,474

    Memory Allocation

    I'm reasonably new to c and dynamic memory allocation really confuses me.

    Take this code snippet:



    #include <stdio.h>
    #include <stdlib.h>

    int main() {
  12. Thread: Array Copying

    by Prodiga1
    Replies
    2
    Views
    1,384

    Brilliant! Thanks cas

    Brilliant! Thanks cas
  13. Thread: Nested loops

    by Prodiga1
    Replies
    5
    Views
    2,604

    Think of separating the problem into two halves:...

    Think of separating the problem into two halves: one for the top half of the triangle and one for the bottom half
  14. Thread: Array Copying

    by Prodiga1
    Replies
    2
    Views
    1,384

    Array Copying

    Hi all--

    This issue is completely perplexing me, the following is code that reads in lines from a file and is supposed to copy each line into an array:


    235 ...
  15. Thread: char **

    by Prodiga1
    Replies
    4
    Views
    1,057

    Thanks!

    Thanks!
  16. Thread: char **

    by Prodiga1
    Replies
    4
    Views
    1,057

    char **

    I'm working with code that grabs strings from a file and then works with said strings in different ways.

    I would like to check if the first character in a char* is a #:



    FILE* file =...
  17. Replies
    10
    Views
    1,345

    Comparison Question

    Why is it fundamentally better to use the syntax:


    if(42 == answer)

    as opposed to:


    if(answer == 42)
  18. Replies
    3
    Views
    713

    Having made the aforementioned change I get the...

    Having made the aforementioned change I get the following error:

    Undefined symbols:
    "KeyValueComparator::operator()(KeyValuePair, KeyValuePair) const", referenced from:
    _main in...
  19. Replies
    3
    Views
    713

    Problem accessing class method

    This has been driving me insane, and I'm not sure what's wrong:

    I have a header file (KeyValueComparator.h):


    #ifndef KEY_COMP
    2 #define KEY_COMP
    3
    4 #include <string>
    5 #include...
  20. Replies
    2
    Views
    1,997

    strcmp problem in c

    I have two char array variables:

    char* key set to "foo"

    and char* test set to "bar"

    When I attempt a strcmp(key, test), my c program seg faults.

    What's going on here?
  21. Replies
    2
    Views
    1,357

    Ok. Does that method do what it is intended to...

    Ok.

    Does that method do what it is intended to do? Create a count_table_t pointer object and return it?
  22. Replies
    2
    Views
    1,357

    Problem returning struct pointer

    Hi--

    I'm having trouble defining a method that is supposed to return a pointer to a struct:



    count_table_t* table_allocate(int size)
    {
    count_table_t *test;
    ...
Results 1 to 22 of 22