Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using FWRITE() to add characters to text file
Message
De
29/12/2005 16:36:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
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:
01081858
Vues:
9
To add text to the END of the file, perhaps it would be simpler to use the StrToFile() function, with the third parameter (lAdditive) = .T.

>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 '%'
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform