Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Basic - <b>print # using formatted output to file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
PRINT # USING            Formatted Output to File

 PRINT #filenum, USING strexpr; exprlist[;]

    Writes to a disk file an image of what would be displayed on screen by
    a corresponding PRINT USING statement.

     filenum    The number under which the file was OPENed.

     strexpr    A string variable or constant specifying the format in
                which the data is to be printed (see below).

    exprlist    Numeric and/or string expressions to print. Each
                expression must be separated from the one after it by
                either a comma or a semicolon.

           ;    If included at the end of the statement, suppresses the
                usual carriage return and line feed.

    Formatting options:

    The following symbols may be used in strexpr:

      Symbol    Meaning

           !    Print only the first character of a string expression.

        \  \    Print only the first n + 2 characters of a string
                expression, where n is the number of spaces between the
                two backslashes. If n is larger than the number of
                characters in the string expression, BASIC pads the string
                expression on the right with space characters.

           &    Print a string expression without reformatting it.

           .    Specifies the position of the decimal point in a numeric
                expression.

           #    A place-holder. If the numeric expression has more digits
                to the right of the decimal point than the format string
                has #s, BASIC rounds. If the numeric expression has more
                digits to the left of the decimal point than the format
                string has #s, BASIC prints all the digits to the left of
                the decimal point and also prints a percent sign (%) to
                the left of the number. If the numeric expression has
                fewer digits to the left of the decimal point than the
                format string has #s, BASIC right-justifies the number;
                that is, it pads the number on the left with spaces. (But
                if there are any #s to the left of the decimal point in
                the format string, Turbo Basic always prints at least one
                digit--a 0 if necessary--to the left of the decimal
                point.)

           +    Print a plus or minus sign, as appropriate, to the left or
                right of the number. The sign is always printed
                immediately to the left or right of the number, depending
                on the position of plus sign.

           -    Print a minus sign immediately to the right of a negative
                number (the minus sign should appear after the place
                holders in the format string).

          $$    Print a dollar sign immediately to the left of the number.
                The double dollar sign also acts as a place holder for two
                additional digits to the left of the decimal point, one of
                which is the dollar sign itself. The dollar sign cannot be
                prefixed to a number printed in exponential format.

          **    Fill any leading spaces with asterisks. The double
                asterisk also acts as a place holder for two additional
                digits to the left of the decimal point.

         **$    Print a dollar sign immediately to the left of the number,
                and fill any remaining leading spaces with asterisks. The
                combination of two asterisks and a dollar sign also acts
                as a place holder for three additional digits, one of
                which is the dollar sign.

        ^^^^    Print a number in exponential format. The four carets
                should appear after all place holders in the format
                string. The four carets are place holders for E.nn or
                D.nn.

           _    Print next character as a literal. The combination _#, for
                example, allows you to include a number sign as a literal
                in your numeric format.

     [other]    Characters other than the foregoing may be included as
                literals in the format string. Thus, for example, a single
                dollar sign may be positioned to the left of a series of
                place holders (#s) to achieve vertically aligned dollar
                signs, and space characters may be placed at the right
                side of the format string to achieve horizontal separation
                between a series of numbers.

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

      Notes:    PRINT # USING outputs exactly the same characters that
                would appear on screen in response to a PRINT USING
                statement. Commas between expressions, for example, result
                in the insertion of space.

                If an expression to be output contains significant quote
                marks or commas, you should surround it with quote marks
                by means of CHR$(34); otherwise, when you input these
                fields, Turbo Basic will interpret the significant commas
                or quotes as delimiters.

See Also: PRINT USING PRINT #

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson