General information
Category:
Coding, syntax & commands
Title:
Using FWRITE() to add characters to text file
Environment versions
Network:
Windows 2000 Server
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 '%'
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only