How do I read from file in CUDA? fstream doesn't load/work properly...

Hey Everyone,

I’ve been working on a project with CUDA and ran into a problem. I’m trying to load my data from a text file and using fstream doesn’t seem to work with CUDA.

Even adding just "#include " in a CUDA code, it gives me 80 some compilation errors. I’ve copied the include files into the CUDA includes, checked my environment paths and yet nothing is working.

When I was searching on google, I also came across a built-in CUDA function “cutReadFilef” (i think that’s how it’s spelled) which also reads from a file. But all my code is already written with fstreams and it would be easier to just get that to work.

So, if anyone knows how to use fstream in CUDA or read from files, please help me. Your assistance is greatly appreciated.


question is answered here: