Hi, i'm having trouble finding a way around a situation like this:
class a{
protected:
vector <b> B;
int some_int;
};
Type: Posts; User: Skeksis
Hi, i'm having trouble finding a way around a situation like this:
class a{
protected:
vector <b> B;
int some_int;
};
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...
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...
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 (){};
...
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...
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");
...
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.
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...
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...
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>...
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...
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.
fsetpos returns 0 for both calls, with or without the rewind line
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);...