You are here:

C++/about creating folders..

Advertisement


Question
I have attempted to search it on yahoo and have only found
stat/fstat regarding linux commands.
I don't know if this was what you meant by stat/fstat functions.

1) is there an online manual page for c++ where i can search up
what i am looking for?

2) i really have no clue in
if (file.txt) { statements; }
is there a way i can figure out if a certain file is available?

Thank you for you help again.
-------------------------
Followup To
Question -
Is there to create folders in C++
and possibly give linux permissions to them?

also, is there a way to "if" if a file exists?
for example if (file.txt) { delete file.txt; }
and if file.txt does exists, execute a statement.

Thank you very much Rai for your support
Answer -
Hi,
  For getting information about any file, please try using stat/fstat functions. Please read man pages for stat/fstat.
Please let me know if you need more information.

Regards,
RaiD

Answer
Hi James,
 Please find the information below.
By the way, on linux, if you are not able to open a file in your code, then it would mean :
[1] File is not there
[2] You do not have permissions for reading that file.

If you use fopen in C then the FILE structure contains the the error indicator too.

NAME
    stat, lstat, fstat - get file status

SYNOPSIS
    #include <sys/types.h>
    #include <sys/stat.h>

    int stat(const char *path, struct stat *buf);

    int lstat(const char *path, struct stat *buf);

    int fstat(int fildes, struct stat *buf);

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dharmender Rai

Expertise

I can answer general and system level C/C++ questions.

Experience

I have 5 years of experience in C++.

©2016 About.com. All rights reserved.