file creation directory  
Author Message
dellthinker





PostPosted: Visual C++ General, file creation directory Top

Hi all, i was curious to know how would i program a function to create a file into any directory. For example. Most windows dirs begin with c:\

But what if they have a custom dir Like E:\ or H:\

I would just like to know if i can make a function that will add a file in the folder no matter what the directory begins with. Thanx in advance!


Visual C++9  
 
 
Sarath.





PostPosted: Visual C++ General, file creation directory Top

You can create Directories using CreateDirectory, CreateDirectory, SHCreateDirectory, or SHCreateDirectoryEx function. If you have enough privilege, you can create and write to any directories.
There are various ways to create files, Win32 calls(CreateFile, etc, C-Runtime calls(fread,fwrite),or MFC classes like CFile or some of its flavours. It's depends on you to choose between
.
AFAIK Windows can be installed in different Locations other than C:\ from Windows 2000 onwards. These locations will be stored in registry, environment variables etc...

Actually what you are trying to do