Subj : Re: fstream arrays To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Wed Feb 25 2004 11:13 pm "D Kat" writes: > The error (and I have stepped through this as well) is done within the > function get_subj_fp - I have taken out the error check on the return of the > function because it doesn't matter - what I'm saying is ignore the fact that > I don't care if I get an error or not. That is not the point. In my way of > veiwing the world Arrays are pointers. You should change your view then. Arrays and pointers are totally different things. The only thing that relates them to each other is that an array is implicitly converted into a pointer to its first element when necessary. > That is how I refer to them. This > is what I care about > > if(!out_files[i]) ...... tests as 1 or as an ERROR > if(!out_file).... tests as 0 or NOT ERROR. > > ofstream outfiles; > vs > ofstream outfiles[3]; > > Why does one return false while the other doesn't - BOTH successfully > open, write and save. There is no conceptual difference between an ofstream that is an array element and an ofstream that isn't. You seem to do something differently when dealing with the array. Consider starting with a simple ofstream. Then change it into an array of 1 (one) ofstream; simply add [1] in its definition and [0] wherever you use it. Then replace the [1] by a [nrOfStreams] (with nrOfStreams being a constent unsigned int of value 1) and the [0] by loops from 0 to nrOfStreams (not inclusive). Then increase nrOfStreams to the value you need it to have. .