Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Low level command
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00602045
Message ID:
00602070
Views:
22
If you're up to date in VFP versions, using the FileToStr() function can greatly simplify copying individual files, as follows:
lcFileContent = FileToStr (thisfile)  IF LEN (lcFileContent) > 0      
   StrToFile (lcFileContent, odrFileName, .T.)   && Final parameter means append to file.

   &&   0 length indicates either an empty file or an error attempting to open.
ENDIF
HTH,

Jay

>Hello all,
>This is a sample of the code
>the idea here to merge a number of txt files into one file txt file
>
>**************
>aa = fopen(thisfile,10)
>If aa < 0
>=messagebox('Unable to open ' + thisfile + ' for uploading',0)
>Release aa
>Loop
>Endif
>l_process = .f.
>Do while not feof(aa)
>l_process = .t.
>newline = fgets(aa)
>=fputs(odrhandle,alltrim(newline))
>**the var odrhandle is another txt file handle- Enddo
>=fclose(aa)
>Release aa
>
>The problem is that many times when I open a file, I am immediately at feof() and I cannot then fclose() the file.
>
>Any ideas about what is going wrong would be gratly appreciated. I've tested the code from the command window and everything works the way one would expect it to work.
>
>Thanks
>
>Sandy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform