Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using FWRITE() to add characters to text file
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Using FWRITE() to add characters to text file
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01081854
Message ID:
01081854
Vues:
182
I have a fairly large text file with 799 characters for each line. Each line already contains a carriage return and line feed. However, there are no delimiters in the record. I am trying to add a character (%) at certain points in each line so that I can pull the records into a foxpro cursor. Right now I can only pull in the first 254 characters of each record.
I've tried using FSEEK() and FWRITE() to write the character '%' to specific positions within the record but for some reason it won't write the character. Any ideas as to what I'm not doing right?

Here's the code I'm using:
cFilename = 'c:\localenv\apps\medipak_Partd_ftp\ELEX_FULL20051206.txt'
cImpTable = 'c:\localenv\apps\Medipak_PartD_Ftp\imp_file'

pnHandle = FOPEN(cfilename)
pnPos1 = FSEEK(pnhandle,10,1)
pAddDelimiter = FWRITE(pnHandle,'%')
pnPos2 = FSEEK(pnhandle,501,1)
pAddDelimiter = FWRITE(pnhandle,'%')
pnPos3 = FSEEK(pnhandle,742,1)
pAddDelimiter = FWRITE(pnhandle,'%')

pClose = FCLOSE(pnHandle)

CREATE CURSOR curNewFile(field1 c(254),field2 c(254),field3 c(254),field4 c(254))
SELECT curNewFile
APPEND FROM (cFilename) TYPE DELIMITED WITH CHARACTER '%'
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform