Viewing File in QuickBasic Environment Can Change Spacing (94315)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0

This article was previously published under Q94315

SUMMARY

If you load a file, other than Basic source code, into the Microsoft QuickBasic environment, the spacing in the file will be changed and additional characters may be added. Since the QuickBasic environment assumes you are loading a Basic source code file, it attempts to parse the contents of any file loaded into the environment. The parsing the environment does will almost certainly alter the spacing of any data files loaded into the environment.

To view the data file, use a text editor, or write a loop that reads in the data file and prints it to the default output window.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start QuickBasic.
  2. Type in the following code:
          OPEN "outfile" FOR OUTPUT AS #1
          FOR i = 1 TO 5
            FOR j = 1 TO 5
                 PRINT #1, USING "###    ###   ";i;j;
            NEXT
            PRINT #1,     ' print space to next line
          NEXT
          CLOSE
    						
  3. Run the program.
If you now try to open the "outfile" file in the editor, it will look as follows:

1112131& 415
2122232& 425
3132333& 435
4142434& 445
5152535& 455

However, the actual output to the file would be as follows:
   1   1   1   2   1   3   1   4   1   5
   2   1   2   2   2   3   2   4   2   5
   3   1   3   2   3   3   3   4   3   5
   4   1   4   2   4   3   4   4   4   5
   5   1   5   2   5   3   5   4   5   5
				
To view the data correctly, display it as follows:
   OPEN "outfile" FOR INPUT AS #1

   WHILE NOT EOF(1)
     LINE INPUT #1, x$
     PRINT  x$
   WEND
				
This will print the data to the screen as it appears in the file.

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB94315