0

hi all
i want to open a file but this file in other directory.and i want to use this function:

int  open(  char  *filename,  int  access,  int  permission  );

i can not use other function, because i have use only system call function.

when file exists beside of my code, there isn't problem. but when exist in other drectory can not open that.

Edited by ferizhandi

4
Contributors
5
Replies
31
Views
4 Years
Discussion Span
Last Post by naveen1993
0

Ah, you haven't turned your PC on. The power is off.

Oh, you say the power is already on? Well, I guess my psychic ability to guess what your problem is must be broken. I'm afraid you're going to have to describe the problem to us.

0

Can you be more specific? What didn't work? What was the path you were trying to use? What kind of error did it return?

ALso, can you give us the OS you are running under? The open() function you describe is primarily a Unix/Linux system call, though there are versions of it that have been ported to DOS and Windows. If you are running under the latte, there may be issues with how it handles pathnames, especially if you are using a DOS compiler (such as Turbo C) under a Windows system.

BTW, do you know why your instructor wants you to use this function? It's a rather unusual requirement, and it might shed some light on it if we knew the reason why.

-1

With reference to ur query,
FILEfp;
int fopen(fp,char
filename,"w");
fp is FILE*, char*filename is filepath, w is file mode i.e., read, write, read and write.

Votes + Comments
With reference to your repeated failure to read the actual query, please read the actual query before offering useless answers.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.