Search:

Type: Posts; User: Skeksis

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    947

    class inheritance troubles

    Hi, i'm having trouble finding a way around a situation like this:



    class a{
    protected:
    vector <b> B;
    int some_int;
    };
  2. Replies
    6
    Views
    1,096

    fixed it in my last edit. Isn't NULL just #DEF...

    fixed it in my last edit. Isn't NULL just #DEF NULL 0? Surely there's no problem?



    I still haven't worked out what to do with that, I haven't got my head around exceptions yet which I hope will...
  3. Replies
    6
    Views
    1,096

    ok, here is the code with a copy constructor, a...

    ok, here is the code with a copy constructor, a destructor and memory allocation in the = operator



    class matrix {
    public:
    double **a;
    int row, col;

    matrix (){a=NULL;}; // is...
  4. Replies
    6
    Views
    1,096

    Am I writing into memory I don't own?

    Here is a very abridged excerpt from a simple matrix manipulation library I'm writing, mostly as a practice project.


    class matrix {
    public:
    double **a;
    int row, col;

    matrix (){};
    ...
  5. Replies
    21
    Views
    3,187

    I understand that the intermediate variable isn't...

    I understand that the intermediate variable isn't necessary, however as this program expands there may well end up being quite a few command line arguments including several file names. I thought it...
  6. Replies
    21
    Views
    3,187

    ok, I understand. so now I have this as my input...

    ok, I understand.
    so now I have this as my input validation, which seems a lot cleaner and just generally better


    if(argc!=2){
    printf("incorrect number of arguments\n");
    ...
  7. Replies
    21
    Views
    3,187

    Good points, I didn't notice a lot of that. I...

    Good points, I didn't notice a lot of that.
    I wasn't aware that the basic c operators such as = worked on strings. As a matter of fact i'm pretty certain they don't, or am i missing something.
  8. Replies
    21
    Views
    3,187

    Thanks for the replies guys. RE no check as to...

    Thanks for the replies guys.

    RE no check as to whether the file opened, I had removed it just to be sure it wasn't causing the problem and it is now reinstated.

    The discussion on style in C is...
  9. Replies
    21
    Views
    3,187

    Thanks, problem solved, i replaced it with this ...

    Thanks, problem solved, i replaced it with this


    out_file = (char *) malloc(strlen(argv[1]));

    strcpy(out_file,argv[1]);

    I presume what I was seeing was undefined behaviour due to my...
  10. Replies
    21
    Views
    3,187

    Does C execute in strict code order?

    I have noticed in many of my programs that later code can affect the outcomes of earlier code. for example:


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>...
  11. Replies
    5
    Views
    2,209

    sorry to have bothered you guys, the problem...

    sorry to have bothered you guys, the problem appears to have disappeared. Must have had something minor wrong that got fixed while messing around with it debugging.

    There was also the secondary...
  12. Replies
    5
    Views
    2,209

    BTW, i've also tried making a copy of start and...

    BTW, i've also tried making a copy of start and using it in the second call just to check whether fsetpos was changing anything there, no difference.
  13. Replies
    5
    Views
    2,209

    fsetpos returns 0 for both calls, with or without...

    fsetpos returns 0 for both calls, with or without the rewind line
  14. Replies
    5
    Views
    2,209

    fgetpos fsetpos problem/confusion

    I'm having a problem with fgetpos and fsetpos when i call fsetpos twice.



    while(0 != fgets(buffer,100,input) && strtod(buffer,NULL) < LOWER)
    fgetpos(input,&start);

    fsetpos(input,&start);...
Results 1 to 14 of 14