   size of text file
  Heya all, I am writing an encoding program for a CUDA project and I was going to write it into a vector, but vectors don't work with CUDA.I am wondering if there is a way to load the text file into a char array whose size is dependent on the size of the file. I'm not sure if there is a simple way to figure out how big the array needs to be from the size of the text file.Sorry if this is a stupid question. I am getting progressively more burnt out by final projects.   
fseek(pFile, SEEK_END);int nBufferSize = ftell(pFile);fseek(pFile, SEEK_SET);nBufferSize -= ftell(pFile); // not sure if this one is actually usefulSomething like this ??   ;  ... or the C++ way:    std::ifstream file("test.txt");    file.seekg(0, std::ios::end);    std::size_t size = file.tellg();    file.seekg(0, std::ios::beg);Voodoohaust's code won't compile because fseek() takes three parameters, not two. The second parameter is an offset from the reference point.   ;Quote:Original post by Windryder... or the C++ way:*** Source Snippet Removed ***Voodoohaust's code won't compile because fseek() takes three parameters, not two. The second parameter is an offset from the reference point.groovy thank you   ;Quote:Original post by way2lazy2carevectors don't work with CUDA.I'm completely unknowledgable about CUDA, but why won't vectors work with CUDA?;Quote:Original post by nobodynewsQuote:Original post by way2lazy2carevectors don't work with CUDA.I'm completely unknowledgable about CUDA, but why won't vectors work with CUDA?I can double check, but I think it has something to do with the nvcc compiler compiling device and kernel methods in C not C++. I donno, I can look around and try a simpler example to see if that's actually the case.   