Close a file pointer in Cuda (nvcc)?

When NVCC compiles your . Cu file, it delegates the compilation of the C/C++ parts of the file to your native C/C++ compiler ( gcc in your case). So, the error is coming from gcc.

Up vote 0 down vote favorite share g+ share fb share tw.

In gcc, the close function is used to close the file pointer. However my nvcc complier will not allow that. I can't seem to find a cuda-specific call or alias.

Is there a special cuda file pointer close? This is the error I get. Error: identifier "close" is undefined For this simple code; FILE* fp = fopen(filename,"r"); if(fp == NULL) { return NULL; } close(fp); cuda compiler-errors nvcc link|improve this question asked Apr 13 '11 at 20:41Ray3011668 83% accept rate.

2 Try fclose(). Nvcc is not touching the code, it is being compiled with your host compiler and the error and the question have nothing to do with CUDA. – talonmies Apr 13 '11 at 20:50.

When NVCC compiles your . Cu file, it delegates the compilation of the C/C++ parts of the file to your native C/C++ compiler (gcc in your case). So, the error is coming from gcc.

You need to check why gcc is producing this error for the code in this file. Most probably, you have not included the necessary header file where close() is defined, unistd.h. Or try fclose() as another commenter has suggested.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions