Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to I merge two or multiple text file in fox pro.
Message
De
20/07/2005 06:58:42
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
19/07/2005 13:57:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01033948
Message ID:
01034171
Vues:
23
>Hey guys,
>I am new to fox pro. However, I need code that will merge two or more text files or perhaps someone could point me to a reference source where I could research the code.

StrToFile( FileToStr( < file1 > ), 'merged.txt')
StrToFile( FileToStr( < file2 > ), 'merged.txt', .t.)
StrToFile( FileToStr( < file3 > ), 'merged.txt', .t.)

ie: Merge files in a list
local lcFileList,ix
local array aFiles[1]
lcFileList = "c:\myFolder1\myTextFile1.txt,c:\myLong Folder2\myTextFile1.txt," + ;
  "c:\myFolder1\myTextFile2.txt,c:\myLong Folder2\myTextFile2.txt"
StrToFile('','merged.txt') && Create initial empty
for m.ix=1 to alines(aFiles,m.lcFileList,.t.,',')
  StrToFile( FileToStr( aFiles[m.ix] ), 'merged.txt', .t.)
endfor
This assumes text files are not over 16Mb each.

Lowlevel functions like fcreate(),fopen(), fread() ... are available.
You could also create a cursor with a memo field and use append memo to merge into memo then dump out with copy memo.
etc
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform