NI Home > Community > NI Discussion Forums

LabWindows/CVI

Reply
Member
Moxcoak
Posts: 15
0 Kudos

CopyFile does not copy a large file.

I am using the LabWindows CopyFile function to copy all files from my current working folder to another folder on the same disk. This function works fine, except for when one of the files is very large. My 516Mb file comes across with size 0, however the CopyFile returns status 0 (success). Is there something I'm missing? Some system setting exceeded? Why doesn't CopyFile return a fail status?

More Details:
- A file is created, but the size is zero for large files.
- CopyFile works fine with my 264Mb file. So I seem to be exceeding a limit with files somewhere between 264Mb and 516Mb.
- code: status = CopyFile ("*.*", to_file);
where to_file = "..\\..\\Data Files\\folder_8910_ff_sssss_ddddd_tt-ttt\\*.*"
- I have Gigs of free space on my disk.
- Copying the file using Cut/Paste through Windows Explorer works fine, so the file seems OK.
- The other 7 files get copied correctly. They total 57Mb.
- I include "Utility.h" in my code.

Thanks.
Active Participant
test_man
Posts: 377
0 Kudos

Re: CopyFile does not copy a large file.

Try windows SDK's CopyFile function and see if that works.
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
Member
Moxcoak
Posts: 15
0 Kudos

Re: CopyFile does not copy a large file.

I included "windows.h" before "utility.h", but it didn't make a difference. I don't think its calling the SDK function. How do I call SDK CopyFile when I need to include "utiltity.h" for other items? Do I have to pull this routine out to a separate source file and include only "windows.h" or is there a way without re-writing my code?
Active Participant
test_man
Posts: 377
0 Kudos

Re: CopyFile does not copy a large file.

http://digital.ni.com/public.nsf/allkb/69C82671913CAA4986256E9400676E17
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
Member
Alex D
Posts: 138
0 Kudos

Re: CopyFile does not copy a large file.

Whenever names in CVI collide with names in the SDK, what we typically do is to prepend CVI_ to the function name. Then in the header file, we use a macro to translate one name to the other (ex. #define CopyFile CVI_CopyFile). Therefore, if you want to expose the SDK CopyFile, after you include utility.h, do an #undef CopyFile. Normally this would work, except the SDK function call is ALSO a macro; CopyFile references CopyFileA or CopyFileW, depending on your system. So, you can either call CopyFileA directly (CopyFileW is for unicode filenames) or do this:


#include "windows.h"
#include "utility.h"
#undef CopyFile
#ifdef UNICODE
#define CopyFile CopyFileW
#else
#define CopyFile CopyFileA
#endif // !UNICODE


int func (void)
{
const char *a = "a.txt", *b = "b.txt";
CopyFile (a, b, FALSE); // fine, calls the SDK function
CVI_CopyFile (a, b); // also fine, calls the CVI function
}


On a side note, I have been trying to reproduce a failure like this in house and have not been able to. Could you give me some more details on your system configuration, etc.? What version of CVI and what version of Windows is this under? Also, what version of the CVI runtime engine is installed?

Hope this helps.

Thanks,

-alex
Member
Moxcoak
Posts: 15
0 Kudos

Re: CopyFile does not copy a large file.

Labwindows/CVI 7.0.0 (393)
Windows XP Pro (version 2002 SP1)
C:\WINDOWS\system32\cvirte.dll version = 7.0 (file version 7.0.0.395)

CopyFileA worked fine. I just have to copy each file one at a time instead of using *.* with the LabWindows CopyFile.