see i have make one program which create one new file just using
fopen()
Now i want to print full path of that file’s in ma program.
How is that possible in linux with c programming?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Standard C by itself provides no way to do this, actually. But the POSIX standard has getcwd. What you would do is append the path used to create the file to the working directory path obtained from
getcwd— unless, of course, the path used to create the file is an absolute path.Alternatively, you could use realpath.