hi ,
I was trying to open a file using fopen() method. It's not opening all the time. some time it opens but the other time its getting crashed....
FILE* tmpfile = fopen(xxxxxx, "r")
this is the code i am using....
and every time the value of xxxx is coming correctly.....
wat may be the problem...
will it occur of i try to open the file when the file is already accessed by some other function......(if so is there any lock option for it)
Please help me out.....
Regards,
Sharath.
do you have a short sample of code that has the error in it?
#define MAX_LENGHT = 3000;
string File = XXXXX;
char FileName[MAX_LEN];
memset(FileName, 0, MAX_LEN);
FILE* tmpfile = fopen(File.c_str(), "r");
if (NULL == tmpfile)
{
return false;
}
else
{
strcpy(FileName, File.c_str());
fclose(tmpfile);
}
the file gets open correctly, but you use MAX_LEN and MAX_LENGHT. do you want this?