PRB: ??? "{" Returns Syntax Error (96299)



The information in this article applies to:

  • Microsoft FoxPro for Windows 2.5
  • Microsoft FoxPro for Windows 2.5a
  • Microsoft FoxPro for MS-DOS 2.0
  • Microsoft FoxPro for MS-DOS 2.5
  • Microsoft FoxPro for MS-DOS 2.5a

This article was previously published under Q96299

SYMPTOMS

Attempting to print a single brace ("{" or "}") with the ??? command results in a syntax error because FoxPro expects a matching pair of braces in the command line.

CAUSE

The ??? command sends text directly to the printer. This method is normally used to send "Escape" codes to change printer settings. Using braces is one of three ways to identify ASCII characters. For example, each of the following identify the letter "k" (107 on the ASCII chart):
  • CHR(107)
  • "k"
  • {107}
FoxPro expects braces in pairs when the text is evaluated with the ??? command. If text (either a string or file) is sent to the printer using the ??? command, and the text includes a single brace ("{" or "}") without a matching brace on the same line, FoxPro detects the first brace as the beginning or end of an ASCII character code sequence.

RESOLUTION

Replace all single left braces ("{") with "{123}" and single right braces ("}") with "{125}". "{123}" will be interpreted as ASCII 123 and the "{" will be printed out and likewise for the right brace.

The following snippet provides an example:
   SET PRINTER TO xxx.txt
   ??? "{123}"
   SET PRINTER TO
   MODIFY FILE xxx.txt
				
The text file will contain a single left brace.

Another alternative is to use "{{}" and "{}}" to output a single left and right brace, respectively. The following command, if used in the above code example, will also output a single left brace to the text file:
   ??? "{{}"
				

STATUS

This behavior is by design.

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:KB96299