How to Use Continuation Lines When Printing Literal Strings

Last reviewed: February 29, 1996
Article ID: Q147762
The information in this article applies to:
  • Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0

SUMMARY

Incorrectly specifying a literal string on a continuation line may produce unwanted results when printing the string. For example, extra blank spaces may be printed.

MORE INFORMATION

Do one of the following to prevent extra spacing of a literal string continued on a continuation line:

  • In fixed form source code, enclose the literal string in quotation marks, and use the concatenation operator "//" at the end of the line with any character other than a blank or zero at the begining of the next line.
  • In free-form source code, use an "&" at the end of the literal string to be continued and another "&" at the beginning of the continued literal string on the next line.

The following sample code demonstrates the problem of incorrectly using a literal string on a continuation line.

Sample Code #1

C Compile options needed: none C Fixed form source code

C This prints 'Hi + 64 blank spaces + world'.

      print *,  'Hi
     &           world'
      end

The following two code samples illustrate the correct way to print a literal string on a continuation line:

Sample Code #2

C Compile options needed: none C Fixed form source code

$NOFREEFORM

C This prints 'Hi world'

      print *,  'Hi' //
     & ' world'
      end

Sample Code #3

C Compile options needed: none C Free form source code

$FREEFORM

! This prints 'Hi world'

      print *,  'Hi&
     & world'
      end


Additional reference words: 4.00 kbinf
KBCategory: kbprg kbusage kbhowto
KBSubcategory: FORTLngIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.