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

VFP ?|?? Issue on Windows 10

Status
Not open for further replies.

spearman

IS-IT--Management
Oct 30, 2001
2
US
Hi Everyone,

I switched over to a 64bit Windows 10 Pro machine about a month ago and have been running various VFP apps without any issues. However, today I encountered a problem running an app which extracts data into a space delimited file. The space delimited file now had 2 spaces in between data columns when previously there was only 1 space. I can replicate the problem in the command window:

? "12345", ltrim(str(678.90,12,2)) returns 12345 678.90 (2 spaces between the 5 and 6)
should return 12345 678.90 (1 spaces between the 5 and 6)

? "12345"+" "+ltrim(str(678.90,12,2)) returns 12345 678.90 (1 spaces between the 5 and 6)

So, the problem has something to do with the comma separator. SET SPACE ON is set. This should only cause the comma separator to add a single space. I'm wondering if there is some default VFP setting that I'm forgetting to adjust or some other simple adjustment. Has anyone else encountered this issue or does anyone have a suggestion? Also, fwiw, I'm running VFP 9.0 SP2.

Thanks in advance,

Jeff
 
I don't think there's ever been a promise about how the ? command interprets the , separator. I certainly wouldn't rely on it. If you want to control the format of output, use the COPY TO command.

Tamar
 
Under the VFP documentation, it states:
SET SPACE ON | OFF

Parameters
ON
(Default)
Inserts a space between fields and expressions.

OFF
Removes all spaces between fields or expressions and runs them together.

"a space" means 1 space to me. Anyway, problem solved!! After comparing all settings listed through the debugger, I got to thinking that maybe the debugger dump was not complete. So, I went hunting for more settings. When I looked at Tools/Options/IDE Type:Desktop Font, I saw that my old Win7 PC was set to courier,10,N,1. My new Win10 PC was set to arial,10,N,1. I changed the setting on the new PC and the problem went away... comma separators are now generating only 1 space. I then changed my Win7 settings to Arial and the issue occurred there. So, this is a VFP issue and not a Windows issue.
 
So it wasn't a case of VFP inserting an extra space. VFP was behaving correctly - as per the spec for SET SPACE. But you were interpreting the single space as two spaces because of the proportional font.

That explains why I couldn't reproduce the problem. When I tested your code, I first set the font to Courier New, precisely because I wanted to be sure of the number of spaces that I could see.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top