| Author |
Copying Files with CFile
|
|
| German 2005-08-08, 5:05 pm |
| Hi Team :
Do you have any suggestions what are the steps to reach this action ?
Thanks in advanced,
German Medina
+511-9662-8500
| |
| Scot T Brennecke 2005-08-08, 5:05 pm |
| Why use CFile to copy a file when you can simply call the ::CopyFile Win32 API function?
If you insist, just create two CFile objects; one to open the source file read-only, and one to
open/create the destination file. Then just use Read and Write to bring the input file contents
over to the output file.
"German" <German@discussions.microsoft.com> wrote in message
news:AA5F76A9-9E47-4704-A83F-A9DAF6ABB91D@microsoft.com...
> Hi Team :
>
> Do you have any suggestions what are the steps to reach this action ?
>
> Thanks in advanced,
>
> German Medina
> +511-9662-8500
| |
|
| Why don't use SHFileOperation!?
Ale
"German" wrote:
> Hi Team :
>
> Do you have any suggestions what are the steps to reach this action ?
>
> Thanks in advanced,
>
> German Medina
> +511-9662-8500
| |
| German 2005-08-08, 5:05 pm |
| OK Scott :
But the problem is when I want to read the entire file with CFile :
Please check this one :
UINT nA=0;
char Buffer[256];
CFile fent1;
fent1.Open("D:/Tabla2.xls", CFile::modeRead | CFile::typeBinary);
File_long=fent1.GetLength();
fent1.S (0,CFile::begin);
nA=fent1.Read(Buffer,sizeof(Buffer)); // this sentence does not complete
reading file action
How do i continue ?
Thanks in advanced again ,
German Medina
+511-9662-8500
"Scot T Brennecke" wrote:
> Why use CFile to copy a file when you can simply call the ::CopyFile Win32 API function?
> If you insist, just create two CFile objects; one to open the source file read-only, and one to
> open/create the destination file. Then just use Read and Write to bring the input file contents
> over to the output file.
>
> "German" <German@discussions.microsoft.com> wrote in message
> news:AA5F76A9-9E47-4704-A83F-A9DAF6ABB91D@microsoft.com...
>
>
>
| |
| German 2005-08-08, 5:05 pm |
| Hi ALe :
Because I lose some control (char in CFile::Read,Write) of information (that
I need internally) during copy process.
Best Regards,
German
"Ale" wrote:
[color=darkred]
> Why don't use SHFileOperation!?
>
> Ale
>
> "German" wrote:
>
| |
|
| You need to read block of specific size till the end of file, for each block
readed write it into dest file...
Take a look at:
http://msdn.microsoft.com/library/d...e.3a3a.open.asp
Ale
"German" wrote:
[color=darkred]
> OK Scott :
>
> But the problem is when I want to read the entire file with CFile :
> Please check this one :
>
> UINT nA=0;
> char Buffer[256];
> CFile fent1;
> fent1.Open("D:/Tabla2.xls", CFile::modeRead | CFile::typeBinary);
> File_long=fent1.GetLength();
> fent1.S (0,CFile::begin);
> nA=fent1.Read(Buffer,sizeof(Buffer)); // this sentence does not complete
> reading file action
>
> How do i continue ?
> Thanks in advanced again ,
>
> German Medina
> +511-9662-8500
>
>
> "Scot T Brennecke" wrote:
>
| |
| German 2005-08-08, 5:05 pm |
| Hi Ale :
I have folllowed your link :
Take a look at:
http://msdn.microsoft.com/library/d...e.3a3a.open.asp
And It works fine.
Thank you very much !!
German Medina
+511-9662-8500
Ale
"German" wrote:
[color=darkred]
> Hi ALe :
>
> Because I lose some control (char in CFile::Read,Write) of information (that
> I need internally) during copy process.
> Best Regards,
> German
>
>
> "Ale" wrote:
>
| |
| CheckAbdoul 2005-08-08, 5:05 pm |
| If you want to display some progress information during the copy
process, then you might want to try the CopyFileEx() API which will allow
you to use a callback routine.
--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------
"German" <German@discussions.microsoft.com> wrote in message
news:0B0B9B34-79E9-4FFC-9138-1954AEB196A7@microsoft.com...
> Hi ALe :
>
> Because I lose some control (char in CFile::Read,Write) of information
(that[color=darkred]
> I need internally) during copy process.
> Best Regards,
> German
>
>
> "Ale" wrote:
>
| |
| Tom Serface 2005-08-08, 10:03 pm |
| You could also use ::CopyFile() to copy files. It works fine. No feedback
that I know of except whether or not it works.
Tom
"German" <German@discussions.microsoft.com> wrote in message
news:8B396259-CFC6-417B-8A47-CA69D2FFE5D8@microsoft.com...[color=darkred]
> Hi Ale :
>
> I have folllowed your link :
> Take a look at:
> http://msdn.microsoft.com/library/d...e.3a3a.open.asp
>
> And It works fine.
> Thank you very much !!
>
> German Medina
> +511-9662-8500
>
> Ale
>
>
>
> "German" wrote:
>
|
|
|
|