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 17:09:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
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:
01081874
Vues:
9
>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 '%'


Amy,
No need to insert chars.
cFilename = 'c:\localenv\apps\medipak_Partd_ftp\ELEX_FULL20051206.txt'
cImpTable = 'c:\localenv\apps\Medipak_PartD_Ftp\imp_file'


CREATE CURSOR curNewFile(field1 c(254),field2 c(254),field3 c(254),field4 c(254))
SELECT curNewFile
APPEND FROM (m.cFilename) TYPE SDF
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