Link to home
Start Free TrialLog in
Avatar of onlyshiza
onlyshiza

asked on

File handling in C++ on Linux/Unix platform

Hi everyone,

I have a bunch of file handling code that I am writing in VC++ 6.0. I am mostly using the methods defined in <io.h> such as _finddata_t structure , _chdir(), rename(), _getcwd() and alike. At sime point it might be necessary to compile the application I am coding on a Linux platform. I don't think these methods are unix compatible. I don't have any experience coding on a linux/unix platform. I need to know if there are any file handling modules that can be compatible on both platforms or a way to make minimal changes to the existing code which makes it possible to compile it on a linux platform.

Any suggestions or reference to a resource(online, books,...) is appreciated.

onlyshiza
Avatar of GaryFx
GaryFx

For the I/O itself, try sticking with the C++ library, specifically iostream and related classes.

Unfortunately, these don't address directory issues.  

Gary
Avatar of onlyshiza

ASKER

well,  it's mostly directory manipulation like finding the name of the current directory, file names in a directory or renaming/ deleting/ saving a file.
ASKER CERTIFIED SOLUTION
Avatar of Axter
Axter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks Axter. How about the _finddata_t structure. Is this also supported on Linux/UNIX or is there any similar structure?
Unfortunately, the find directory logic is not the same.  Most Linux/UNIX platforms use the type of find directory functions used in the Bordland compiler.

You'll find other directory functions like chdir, mkdir, rmdir, etc..
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial