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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text noshow problem

Status
Not open for further replies.

samsnead

Programmer
Sep 3, 2005
100
0
0
CA
We have an application that creates XML file using text endtext code - see below. In a recent case VFP but an extra carriage return line feed in the </charge_desc> delimiter - all other records in the file were ok. Has anyone experienced anything like this? Here is code
&& put into txt file
TEXT noshow
<fee>
<charge_date><<lcdate>></charge_date>
<tk_id><<ALLTRIM(STR(ctran1cur.lawyer))>></tk_id>
<charge_desc><<lcdescr>></charge_desc>
<acca_task><<lctask>></acca_task>
<acca_activity><<lcactivity>></acca_activity>
<charge_type>U</charge_type>
<units><<lcunits>></units>
<rate><<lcunitcost>></rate>
<base_amount>lcitemtotal</base_amount>
<total_amount><<lcitemtotal>></total_amount>
</fee>
ENDTEXT


00002dd5:64 61 6d 61 67 65 3c 2f 0d 0a 63 68 61 72 67 65 damage</..charge
00002de5:5f 64 65 73 63 3e _desc>

The carriage return line fee after the </ was inserted by VFP - all other xml records in the file were correct with just </charge_desc>.

Could this be something to do with line length or file length. The line in question had 235 characters of text in lcdescr - is there a limit on line length of 255?
 
Your answer depends on the VFP version your running.
Here are the limits for VFP9 from its' Help File

Maximum # of characters per character string or memory variable. 16,777,184
Maximum # of characters per command line. 8,192
Maximum # of characters per macro substituted line. 8,192
Maximum length of a string literal. 255



David W. Grewe Dave
 
Hi David - using VFP9 sp1 - it looks like the text endtext limit is 255 characters per line - I did some experimenting and have 0d 0a in text if length exceeds 254 - inserted at position 255 - using a hex editor to view. I may have to embed my own od oa in text so that it doesn't corrupt the delimiters.
 
That works perfect for me:
Code:
m1 = REPLICATE([A],300)
TEXT TO lcTest NOSHOW TEXTMERGE  PRETEXT 1
      <test><<m1>></test>
ENDTEXT
STRTOFILE(lcTest,[testme.txt])
MODIFY FILE testme.txt
ERASE testme.txt

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
Microsoft MVP VFP
 
Hi Borislav - that certainly works! I am using fcreate to create my text file then using _text variable so that my data is put into file without using the strtofile. I may have to change to your way. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top