Board index » cppbuilder » streams in bcb3 and bcb6
joel javish
CBuilder Developer |
joel javish
CBuilder Developer |
streams in bcb3 and bcb62006-02-15 01:02:46 PM cppbuilder93 From what I read, using the same source code, I should be able to read/write from/to fstream and stringstream in bcb6 as I did in bcb3. But the program won't compile in bcb6. What am I missing? |
Ed Mulroy
CBuilder Developer |
2006-02-15 01:04:58 PM
Re:streams in bcb3 and bcb6
You are missing two things, the code you used and the text of the error
message. Without them the problem could be anything. . Ed Quotejoel javish wrote in message |
joel javish
CBuilder Developer |
2006-02-17 04:41:01 AM
Re:streams in bcb3 and bcb6
Thanks Ed for your response.
I don't find any recent commentary about read/seekg/curpos and write/seekp/curpos, are these still used? {smallsort} |
maeder
CBuilder Developer |
2006-02-17 04:51:38 AM
Re:streams in bcb3 and bcb6
"joel javish" < XXXX@XXXXX.COM >writes:
QuoteI don't find any recent commentary about read/seekg/curpos and |
Hendrik Schober
CBuilder Developer |
2006-02-17 05:29:41 PM
Re:streams in bcb3 and bcb6
joel javish < XXXX@XXXXX.COM >wrote:
QuoteThanks Ed for your response. <50) lines of code reproducing the problem plus the exact error message you are getting. More often than never it's a good idea to also post what you're trying to do with that piece of code (because quite often posters are shown better ways to achieve that). Schobi -- XXXX@XXXXX.COM is never read I'm Schobi at suespammers dot org "If you put a large switch in some cave somewhere, with a sign on it saying 'End-of-the-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry." Terry Pratchett |
joel javish
CBuilder Developer |
2006-02-19 07:32:16 AM
Re:streams in bcb3 and bcb6
Thanks Tom, Hendrik for your response.
My source code is in c++. below is in unit2.h: char* ioStr="ioDsk.dta"; //fstream DskFyl();//(ioStr,ios::in|ios::out|ios::binary);//|ios::app);.ope// std::fstream DskFyl();//(ioStr,ios_base:in|ios::out|ios::binary);//|ios::app);.ope// // fstream ioDskFyl("ioDsk.dta",ios::in|ios::out|ios::binary);//|ios::app);.ope// std::stringstream ioRamfyl();//"ioRam.dta",ios::in|ios::out|ios::binary); below is in unit1.cpp: // DskFyl.open();//ioStr,ios::in|ios::out|ios::binary); DskFyl.seekg(0);//curpos);// DskFyl.read(( char*)&(*pRandArr),sizeof(SSortArr));//(*pRandArr));//array));//unsigned//pIoDsk->clsArray ioRamfyl.seekp(curpos); ioRamfyl.write(( char*)&(*pRandArr),sizeof(randArr));//arrayCls));//array));//unsigned//pIoDsk->clsArray In bcb3 I had no problem. But in bcb6, compiler stops after DskFyl, and when I press F1 I get: Compiler Errors: Object Pascal Parameters of this type cannot have default values List of compiler error messages The default parameter mechanism incorporated into the Pascal compiler allows only simple types to be initialized in this manner. You have attempted to use a type that is not supported. program Produce; type ArrayType = array [0..1] of integer; procedure p1(proc : ArrayType = [1, 2]); begin end; end. Default parameters of this type are not supported in Object Pascal. program solve; type ArrayType = array [0..1] of integer; procedure p1(proc : ArrayType); begin end; end. The only way to eliminate this error is to remove the offending parameter assignment or to change the type of the parameter to one that can be initialized with a default value. |
maeder
CBuilder Developer |
2006-02-19 05:01:32 PM
Re:streams in bcb3 and bcb6
"joel javish" < XXXX@XXXXX.COM >writes:
QuoteMy source code is in c++. copy&paste&compile to see what you are seeing. |