You will have to use some windows APIs for both purposes.
ans 1:
Use the CopyFile function for copying the file:
BOOL CopyFile( LPCTSTR lpExistingFileName,
// pointer to name of an existing file
LPCTSTR lpNewFileName,
// pointer to filename to copy to
BOOL bFailIfExists
// flag for operation if file exists
);
bFailIfExists: If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
example:
if(!CopyFile("c:\\test.bmp", "c:\\windows\\test.bmp", FALSE ))
{
// handle error
}
it copies test.bmp from c:\ to c:\windows and overwrites the file if present.
ans 1:
Use the CopyFile function for copying the file:
BOOL CopyFile( LPCTSTR lpExistingFileName,
// pointer to name of an existing file
LPCTSTR lpNewFileName,
// pointer to filename to copy to
BOOL bFailIfExists
// flag for operation if file exists
);
bFailIfExists: If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
example:
if(!CopyFile("c:\\test.bmp
{
// handle error
}
it copies test.bmp from c:\ to c:\windows and overwrites the file if present.
ans 2:
Use CreateDirectory :
if(!CreateDirectory( "c:\\windows\\mydirectory"
{
// handle error
}
This creates a directory called 'mydirectory' in c:\windows
Imp: See that 'c:\windows' should exist, otherwise this call will fail.