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.

Contents • v3.6 Interfaces and Implementations . . . . . . . . . . . . . . . 112Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Generic Graph Algorithms . . . . . . . . . . . . . . . . . . 118Quotient Fields . . . . . . . . . . . . . . . . . . . . . . . . 124A Generic Group Implementation . . . . . . . . . . . . . . 1333.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 1544 Input and Output 155In This Chapter . . . . . . . . . . . . . . . . . . . . . . . 1554.1 A Tutorial Example . . . . . . . . . . . . . . . . . . . . . 1564.2 File Types and Modes . . . . . . . . . . . . . . . . . . . . 160Buffered Files versus Unbuffered Files . . . . . . . . . . . 160Text Files versus Binary Files . . . . . . . . . . . . . . . . 161Read Mode versus Write Mode . . . . . . . . . . . . . . . 162The default and terminal Files . . . . . . . . . . . . . . 1624.3 File Descriptors versus File Names . . . . . . . . . . . . . 1634.4 File Manipulation Commands . . . . . . . . . . . . . . . . 163Opening and Closing Files . . . . . . . . . . . . . . . . . . 163Position Determination and Adjustment . . . . . . . . . . 165Detecting the End of a File . . . . . . . . . . . . . . . . . 166Determining File Status . . . . . . . . . . . . . . . . . . . 166Removing Files . . . . . . . . . . . . . . . . . . . . . . . . 1674.5 Input Commands . . . . . . . . . . . . . . . . . . . . . . . 167Reading Text Lines from a File . . . . . . . . . . . . . . . 167Reading Arbitrary Bytes from a File . . . . . . . . . . . . 168Formatted Input . . . . . . . . . . . . . . . . . . . . . . . 169Reading Maple Statements . . . . . . . . . . . . . . . . . 174Reading Tabular Data . . . . . . . . . . . . . . . . . . . . 1754.6 Output Commands . . . . . . . . . . . . . . . . . . . . . . 176Configuring Output Parameters Using the interface Command. . . . . . . . . . . . . . . . . . . . . . . . . 176One-Dimensional Expression Output . . . . . . . . . . . . 177Two-Dimensional Expression Output . . . . . . . . . . . . 177Writing Maple Strings to a File . . . . . . . . . . . . . . . 180Writing Bytes to a File . . . . . . . . . . . . . . . . . . . . 181Formatted Output . . . . . . . . . . . . . . . . . . . . . . 181Writing Tabular Data . . . . . . . . . . . . . . . . . . . . 185Flushing a Buffered File . . . . . . . . . . . . . . . . . . . 187Redirecting the default Output Stream . . . . . . . . . . 1874.7 Conversion Commands . . . . . . . . . . . . . . . . . . . . 188Conversion between Strings and Lists of Integers . . . . . 188

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

Saved successfully!

Ooh no, something went wrong!