Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [Manta] r2145 - trunk/scenes


Chronological Thread 
  • From: "A.N.M. Imroz Choudhury" <roni@cs.utah.edu>
  • To: Thiago Ize <thiago@sci.utah.edu>
  • Cc: manta@sci.utah.edu
  • Subject: Re: [Manta] r2145 - trunk/scenes
  • Date: Mon, 10 Mar 2008 12:13:05 -0700

Generally, streams become !good() *after* a failure to read (i.e., after
reaching eof and performing another read).  I usually end up writing a
loop like this:

while(true){
  in >> item;
  if(!in.good())
    break;
  fileNames.push_back(item);
}

I think this might be more correct than what you just committed, but I'm
not sure.  STL file streams don't seem to have good idioms for reading
in a loop like this...

roni

On Mon, 2008-03-10 at 11:30, Thiago Ize wrote:
> Author: thiago
> Date: Mon Mar 10 12:30:34 2008
> New Revision: 2145
> 
> Modified:
>    trunk/scenes/triangleSceneViewer.cc
> Log:
> My ifstream skills suck. Hopefully this is the 
> correct way to read in data. This might fix a
> bug with the last frame in a .anim file being
> repeated twice.
> 
> 
> Modified: trunk/scenes/triangleSceneViewer.cc
> ==============================================================================
> --- trunk/scenes/triangleSceneViewer.cc       (original)
> +++ trunk/scenes/triangleSceneViewer.cc       Mon Mar 10 12:30:34 2008
> @@ -155,7 +155,7 @@
>      fileNames.clear();
>      //read in data from modelName and
>      ifstream in(modelName.c_str());
> -    while (in) {
> +    while (in.good()) {
>        in >> modelName;
>        fileNames.push_back(modelName);
>      }






Archive powered by MHonArc 2.6.16.

Top of page