file_exists(php) for c++?
Not in the standard library.
Look into the boost filesystem library (www.boost.org). It is free and works on a few different platforms. If you only need this to work on one platform use that platform''s methods (win32 api or posix standard).
Look into the boost filesystem library (www.boost.org). It is free and works on a few different platforms. If you only need this to work on one platform use that platform''s methods (win32 api or posix standard).
quote:Original post by CProgrammer
Is there an equivalent function to file_exists(php) for c++.
-CProgrammer
fopen can be used to see if a file exists (try to open it read only)
quote:Original post by George2quote:Original post by CProgrammer
Is there an equivalent function to file_exists(php) for c++.
-CProgrammer
fopen can be used to see if a file exists (try to open it read only)
Yeah that would work, but I''m using STL(std::ifstream) and it''d be a bit weird to open with fopen then close and open again.
-CProgrammer
Your using std::ifstream aye?
just call open on your ifstream making sure you only have input caps on (ifstream will default to read only which will work i believe), and then check the open and good flags using is_open() and good() respectively.
i think that''ll work anyway
Lorenz (krysole) Pretterhofer
sleep, caffeine for the weak minded
just call open on your ifstream making sure you only have input caps on (ifstream will default to read only which will work i believe), and then check the open and good flags using is_open() and good() respectively.
i think that''ll work anyway
Lorenz (krysole) Pretterhofer
sleep, caffeine for the weak minded
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement