11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

170 • Chapter 4: Input and Output• The optional width indicates the maximum number of characters toscan for this object. You can use this to scan one larger object as twosmaller objects.The optional modifiers are used to indicate the type of the value tobe returned:l or L The letters l and L are supported for compatibility with the Cscanf function, and indicate that a “long int” or “long long” is to bereturned. In Maple, these flags have no effect.zc or Z One of these flags can precede any of the numeric formats,namely d, o, x, e, f, or g, indicating that a complex value is tobe scanned. The real and imaginary parts of the complex value arescanned by using the specified format with the z or Z elided. Thez format scans the real part, followed by the character specified byc, followed by the imaginary part. The Z format scans the real part,followed by a “+” or “-” sign, followed by the imaginary part, followedby a string of characters corresponding to the current settingof interface(imaginaryunit).The z and Z options can result in one of the few conditions in whichscanf raises an exception. If scanf is scanning a complex value (forexample, the real part has already been successfully scanned), and isunable to finish scanning the remainder (for example, there is no imaginarypart after the real part), scanf raises an exception of the form "‘%1‘ expected in input for complex format ", where %1 is replacedby the expected character (for example, a comma).The code indicates the type of object to scan. It determines the typeof object that Maple returns in the resulting list. The code can be one ofthe following.d The next non-whitespace characters in the input must comprise a signedor unsigned decimal integer. A Maple integer is returned.o The next non-whitespace characters in the input must make up anunsigned octal (base 8) integer. The integer is converted to a decimal,and then returned as a Maple integer.x The next non-whitespace characters in the input must consist of anunsigned hexadecimal (base 16) integer. The letters A through F (upperor lower case) represent the digits corresponding to the decimalnumbers 10 through 15. The integer is converted to a decimal, andthen returned as a Maple integer.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!