R
Ryan
I'm getting a stranger error that I can't seem to figure out. I'm
using Visual C++ 6.0 and trying to compile the following code: (I've
pointed out the line that throws the "error C2143: syntax error :
missing ';' before '['")
#include <algorithm>
#include "frame.h"
#include "myio.h"
int Frame::read() {
int Lf; //Length of segment
int hv;
Lf=read2bytes();
P=readbyte();
y=read2bytes(); x=read2bytes();
nc=readbyte();
hmax=vmax=-1;
for (int i=0;i<nc;i++) {
c.id=readbyte();
idloc[c.id]=i;
hv=readbyte();
c.h=hv>>4; c.v=hv & 0xF;
if (c.h>hmax) hmax=c.h; if (c.v>vmax) vmax=c.v;
c.Tq=readbyte();
}
if (nError) return 0;
return 1;
}
void Frame::extenddata(int row) {
for (;ndatarow<row;ndatarow++) {
data[ndatarow]=new (int *) [nc]; //<--- This is the line with
the error!
for (int i=0;i<nc;i++)
data[ndatarow]=new int[x+40];
}
}
void Frame::cleardata() {
for (int i=0;i<ndatarow;i++) {
for (int j=0;j<nc;j++)
delete [] data[j];
delete [] data;
}
ndatarow=0;
}
Frame::~Frame() {
cleardata();
}
void Frame::write() {
write2bytes(0xFFC0); //SOF0 - Start of Frame 0: Baseline DCT
write2bytes(8+3*nc); //Length of marker segment
writebyte(P);
write2bytes(y); write2bytes(x);
writebyte(nc);
for (int i=0;i<nc;i++) {
writebyte(c.id);
writebyte((c.h<<4)|(c.v));
writebyte(c.Tq);
}
}
Anyone gots any ideas? I've totally stumped!
Thanks for your help,
--Ryan
using Visual C++ 6.0 and trying to compile the following code: (I've
pointed out the line that throws the "error C2143: syntax error :
missing ';' before '['")
#include <algorithm>
#include "frame.h"
#include "myio.h"
int Frame::read() {
int Lf; //Length of segment
int hv;
Lf=read2bytes();
P=readbyte();
y=read2bytes(); x=read2bytes();
nc=readbyte();
hmax=vmax=-1;
for (int i=0;i<nc;i++) {
c.id=readbyte();
idloc[c.id]=i;
hv=readbyte();
c.h=hv>>4; c.v=hv & 0xF;
if (c.h>hmax) hmax=c.h; if (c.v>vmax) vmax=c.v;
c.Tq=readbyte();
}
if (nError) return 0;
return 1;
}
void Frame::extenddata(int row) {
for (;ndatarow<row;ndatarow++) {
data[ndatarow]=new (int *) [nc]; //<--- This is the line with
the error!
for (int i=0;i<nc;i++)
data[ndatarow]=new int[x+40];
}
}
void Frame::cleardata() {
for (int i=0;i<ndatarow;i++) {
for (int j=0;j<nc;j++)
delete [] data[j];
delete [] data;
}
ndatarow=0;
}
Frame::~Frame() {
cleardata();
}
void Frame::write() {
write2bytes(0xFFC0); //SOF0 - Start of Frame 0: Baseline DCT
write2bytes(8+3*nc); //Length of marker segment
writebyte(P);
write2bytes(y); write2bytes(x);
writebyte(nc);
for (int i=0;i<nc;i++) {
writebyte(c.id);
writebyte((c.h<<4)|(c.v));
writebyte(c.Tq);
}
}
Anyone gots any ideas? I've totally stumped!
Thanks for your help,
--Ryan