class pointers

D

Daqian Yang

Hi all,

----code-----
int main(){


xf::Xfile x;
cout <<"before compressing"<<endl;
x.stats();
cout <<"after compressing"<<endl;
x.compress();
x.stats();

xf::Xfile x2 = xf::Xfile("mydata",3,2);
xf::Xfile x3(x2);


x3.stats();


// xf::Xfile* p = new xf::Xfile("mydata2,5,5); //problem is here
// p->stats();

return 0;
}

---code----------

without this line "xf::Xfile* p = new xf::Xfile("mydata2,5,5);" , the
program works perfectly.

but after I insert a pointer here, the compiler gives me this error:

x-main_a2.cpp:22:32: missing terminating " character
x-main_a2.cpp: In function `int main()':
x-main_a2.cpp:25: error: parse error before `return'
x-main_a2.cpp:22: warning: unused variable `xf::Xfile*p'

anyone knoews why? thx :)
 
K

Karl Heinz Buchegger

Daqian said:
Hi all,

----code-----
int main(){

xf::Xfile x;
cout <<"before compressing"<<endl;
x.stats();
cout <<"after compressing"<<endl;
x.compress();
x.stats();

xf::Xfile x2 = xf::Xfile("mydata",3,2);
xf::Xfile x3(x2);

x3.stats();

// xf::Xfile* p = new xf::Xfile("mydata2,5,5); //problem is here
// p->stats();

return 0;
}

---code----------

without this line "xf::Xfile* p = new xf::Xfile("mydata2,5,5);" , the
program works perfectly.

but after I insert a pointer here, the compiler gives me this error:

x-main_a2.cpp:22:32: missing terminating " character
x-main_a2.cpp: In function `int main()':
x-main_a2.cpp:25: error: parse error before `return'
x-main_a2.cpp:22: warning: unused variable `xf::Xfile*p'

anyone knoews why? thx :)

The compiler already told you. missing terminating " character.
Look up the line in question:
// xf::Xfile* p = new xf::Xfile("mydata2,5,5); //problem is here
^
Where is the closing " for this ---+
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top