Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FGETS() after reading a file line, is inserting a blank character after each valid character.

JoseGala

Programmer
Sep 23, 2024
1
0
1
After executing the FGETS(file_handle) command Visual FoxPro 9.0 for reading a TXT file, the line has double its original size since it has a blank inserted after each original character

ORIGINAL LINE in TXT file
Date & Time Range: 1/01/21 0:00 12/31/21 23:59

DELIVERY LINE after FGETS()
D a t e & T i m e R a n g e : 1 / 0 1 / 2 1 0 : 0 0 1 2 / 3 1 / 2 1 2 3 : 5 9

What could be cause?
Thank in advance for your help on this

Jose Gala
 
Jose,

The text file is in UNICODE. If possible, FILETOSTR() the file and STRCONV() afterwards.

If you must use FGETS(), you'll have to deal with the fact that the CR+LF characters marking the end of a line are also in UNICODE, taking four bytes instead of the two bytes that FGETS() expects.
 
After executing the FGETS(file_handle) command Visual FoxPro 9.0 for reading a TXT file, the line has double its original size since it has a blank inserted after each original character

ORIGINAL LINE in TXT file
Date & Time Range: 1/01/21 0:00 12/31/21 23:59

DELIVERY LINE after FGETS()
D a t e & T i m e R a n g e : 1 / 0 1 / 2 1 0 : 0 0 1 2 / 3 1 / 2 1 2 3 : 5 9

What could be cause?
Thank in advance for your help on this

Jose Gala
You could also try the ALINES function. Then process the array.
 

Part and Inventory Search

Sponsor

Back
Top