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.

Recommended Answers

You can get details about what happened after fopen() failure like this:

FILE* tmpfile = fopen(xxxxxx, "r");

if (!tmpfile)
{
    perror("Error opening file");
}
Jump to Post

All 2 Replies

You can get details about what happened after fopen() failure like this:

FILE* tmpfile = fopen(xxxxxx, "r");

if (!tmpfile)
{
    perror("Error opening file");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.