Strange File I/O Problem

Hello everybody,

I I have a strange problem.

I simply try to read out a file in the following way:

#include <iostream>

#include <fstream>

#include <cuda.h>

using namespace std;

int main() {

        ifstream ifs;"sequence.fl",ifstream::in);

string line;

        while(!ifs.eof()) {


                cout << line << endl;



        return 0;


When I compile the code with nvcc (release 4.0, V0.2.1221) then the while loop never converges. This means the eof() always returns false.

If I compile the code with g++ or gcc (4.2), everything works fine.

I use OS-X Snow Leopard.

Does someone know what the problem could be? That is a really annoying problem because I try to parallelize some computations in a big project. Everything works fine until now. Only try to figure out this strange behavior.

Thanks a lot,


I can confirm this bug - and it is most annoying and in need of a fix

nvcc 4.0 v0.2.1221

g++ 4.2.1

Mac OS x 10.6.8

a simple catch to terminate the loop by counting empty lines is

int emptyline = 0;

        while(!ifs.eof() && emptyline <100) {


                if (line.length()>0) {

                    cout << line << endl;


                } else {