Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

WriteFormat

A typical format string structure would look something like:

(rDw.o rDw.o)

where r stands for the number of repetitions of a given format, D for the descriptor of the information to be printed in the field (ie what type of info it is, like character or integer), w for the width of the field and o for options, if available. Besides the descriptor, all the necessary values are integers and are optional. The most interesting types are:

  • A: Characters
  • F: Floating point characters, where o represents the number of digits after the decimal point.
  • I: Integers, where o represent the minimum number of digits to be printed

Example:

(A8,3A2,I10.5,F4.2)

would be:

  • A string of 8 characters
  • 3 strings of 2 characters
  • An integer of up to 10 digits, with padding 0 to make it at least 5 characters long
  • A floating number, 4 characters wide with 2 digits after the decimal poin
Edit - History - Print - Recent Changes - Search
Page last modified on September 09, 2015, at 04:46 PM