file.getline()/cout problem

Grant Edwards grante at visi.com
Fri Apr 5 17:42:42 EST 2002


In article <3cae0463.46737479 at mammoth.usenet-access.com>, A. Jones wrote:

> In trying to understand how file access might work in my instance, I
> wrote a small test program with the expectation that it would print
> off 35 lines of arbitrarily length of a file.
[...]
> #include <iostream.h>
> #include <string.h>
> #include <fstream.h>
> 
> ifstream testfile("QOD.qdb");
[...]

Perhaps my Python installation is broken, but this program
won't run at all!

$ python
Python 2.1.1 (#1, Aug 13 2001, 19:37:40) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-96)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> #include <iostream.h>
... #include <string.h>
... #include <fstream.h>
... 
>>> ifstream testfile("QOD.qdb");
  File "<stdin>", line 1
    ifstream testfile("QOD.qdb");
                    ^
SyntaxError: invalid syntax
>>> 



-- 
Grant Edwards                   grante             Yow!  An INK-LING? Sure --
                                  at               TAKE one!! Did you BUY any
                               visi.com            COMMUNIST UNIFORMS??



More information about the Python-list mailing list