70a Subj : Re: fstream arrays To : borland.public.cpp.borlandcpp From : "D Kat" Date : Wed Feb 25 2004 03:26 pm the file open is called only once for any given item of the array (which is when the " if (!out_files[file]) error is declared), the data is written at the end of the program (successfully), and the files are closed sucessfully. The program works without any error at all when I do NOT declare the fstream variable to be an array and when I do open the fstream as array items it does actually open a file even though it claims to be returning a 0 when checked. I have lived with this for some years but am now having a similar enough problem in the GUI domain that I need to understand how arrays of stream pointers differ from streams. " Bruce Salzman" wrote in message news:403ce4e6$1@newsgroups.borland.com... > > In the work I do I must have fstreams that are arrays (there are many > > reasons for this.... I have to access the fstream I need at any particular > > time with a mathematical formula). On error checking of the opening of > > these streams I get errors. When I ignore the error messages the files > > actually function just fine (data is written out to them without error). > > Your code seems to work fine for me (after getting it to compile ;). (I > created a new 32-bit console project for testing.) > You create an array of default constructed fstreams which have global scope. > Then they are attached to some files when get_subj_fp calls open. So far, so > good. These streams will then remain open until your program exits. If you > call get_subj_fp again for one of these files, you'll get an error. Or do > you close the streams somewhere else? > > Regards, > Bruce > > . 0