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

Foxpro 9 spaces w/ ?? in set alternate

Status
Not open for further replies.

kerichsen

Programmer
Nov 22, 2005
3
US
I am <sometimes> getting extraneous spaces in a file created by set alternate on in Fox 9. I don't get the extra spaces in Fox 6 or dBase IV.

Here's the code:

------------------------------------------------------------
Set ALTERNATE TO foo.txt
Set Alternate ON
m_text="Here is some text"
?m_text
??" on "
??DATE()
??"by "
??alltrim(VERSION())
?"**********************"
?"<@SECTION TITLE:>"
??"COUNTY SCHOOL DISTRICTS"
Set Alternate OFF
Set Alternate TO
Modify File FOO.TXT NOWAIT
-----------------------------------------------------------

here's the result:

-----------------------------------------------

Here is some text on 11/30/2005 by Visual FoxPro 09.00.0000.2412 for Windows
**********************
<@SECTION TITLE:> COUNTY SCHOOL DISTRICTS 
-------------------------------------------------

Note that in the first line of output, ?? works correctly. In the second, I get extraneous spaces between the ">" (a Pagemaker formatting directive), and "COUNTY". Note also the LF/CR at the start, the trailing spaces after "DISTRICTS" and the odd character (eof mark?) at the end.

Can you offer any guidance on controlling text output in Fox 9?

thanks
 
Haven't done much with this kind of thing, but I'd suggest trying the SET TEXTMERGE approach as opposed to SET ALTERNATE.

Regards,
Jim
 

kerichsen,

Interesting. I'm seeing the same results as you, both in VFP 7.0 and 9.0. I don't have any earlier versions installed for comparison.

By the way, you're right about the funny square at the end. That would be an ASCII 26, which is an end-of-file marker.

For this kind of output, I agree with Jim that TEXT/ENDTEXT is a better approach. You can do TEXT TO <variable> NOSHOW, and then STRTOFILE() to copy the variable to a text file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike, I'm definitely not seeing this behavior. What's different in our setups? Language settings?
 
I'm seeing extras spaces after the angle bracket, with a total of 6 spaces there.

Looks like it's a function of _SCREEN.FontSize. When I go down from 13 to 10, I get 4 spaces there.

Tamar
 
I tried _screen.fontzie from 8 to 24 and still don't see any extra spaces.

Note: this is VFP9 RTM I'm trying. The SP beta is not installed on this machine.
 
Bingo.

_SCREEN.FontSize=9
_SCREEN.FontName="Courier"

I found that after a point, decreasing the font size made the extraneous spacing worse. So I also wondered if the font might be part of the problem. I tried 9 point because that's what the Fox 9 (SP1 beta) says is the default. The output now is correct and all those pesky extraneous spaces are gone.

Interestingly: set textmerge can capture chr(9) in a .TXT file, but set alternate converts ascii tabs to spaces. Tools | Options |IDE |Indentation is set to "keep tabs" for TXT files.

This has been a nuisance with Fox/dBase from time immemorial.

Kurt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top