Go to Overview over all GrAL packages.
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

src/IO/skip-comments.C

Go to the documentation of this file.
00001 
00002 // $LICENSE
00003 
00004 #include "IO/skip-comments.h"
00005 
00006 template<>
00007 skip_comments_istream& operator>>(skip_comments_istream& in, std::string& s)
00008 {
00009   istream& in1(in.the_istream());
00010   int max_len = 256;
00011   char* ss = new char[max_len];
00012   // string ss = "";
00013   int i = 0;
00014   char c = 'a';
00015   while(in1 && i < max_len-1 && (c != in.begin_comment()) && ! isspace(c)) {
00016     c = in1.get();
00017     ss[i] = c;
00018     i++;
00019   };
00020   
00021   if(c == in.begin_comment() || isspace(c)) {
00022     if(in1)
00023       in1.putback(c);
00024     i--;
00025   }
00026 
00027    ss[i] = '\0';
00028   s = ss;
00029   return in;
00030 }

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 15:57:06 2002 for External control by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000