Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending low level files together
Message
De
06/08/2003 12:33:48
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00817370
Message ID:
00817379
Vues:
18
>Can anyone tell me how to append two files together using visual fox?
>These two files are not dbf's just plain txt files. I'm looking for
>a function that will allow me to concatenate them together without having
>to call DOS to do it.
>
>Thanks

You can do it using Low Level File Functions
ln_hnd1 = FOPEN('file1.txt',2) && Open first file
=FSEEK(ln_hnd1, 0, 2) && go bottom
ln_hnd2 = FOPEN('file2.txt',2) && Open Second File
DO WHILE .NOT. FEOF(ln_hnd2)
  =FWRITE(ln_hnd1, FREAD(ln_hnd2, 1024 *  1024))
ENDDO
=FCLOSE(ln_hnd1)
=FCLOSE(ln_hnd2)
Or you could use the FILETOSTR functios and the STRTOFILE if the files aren't too large
=STRTOFILE(FILETOSTR('file1.txt') + FILETOSTR('file2.txt'), 'file1.txt')
Charles

"The code knows no master." - Chuck Mautz
"Everybody is ignorant, only on different subjects." - Will Rogers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform