MSL C Reference 9.0
Total Page:16
File Type:pdf, Size:1020Kb
MSL C Reference 9.0 Revised <Date> Revised <Date> Metrowerks and the Metrowerks logo are registered trademarks of Metrowerks Corporation in the United States and/or other countries. CodeWarrior is a trademark or registered trademark of Metrowerks Corporation in the United States and/or other countries. All other trade names and trademarks are the property of their respective owners. Copyright © 2004 Metrowerks Corporation. ALL RIGHTS RESERVED. No portion of this document may be reproduced or transmitted in any form or by any means, electronic or me- chanical, without prior written permission from Metrowerks. Use of this document and related materials are governed by the license agreement that accompanied the product to which this manual pertains. This document may be printed for non-commercial personal use only in accordance with the aforementioned license agreement. If you do not have a copy of the license agreement, contact your Metrowerks representative or call 1-800-377- 5416 (if outside the U.S., call +1-512-996-5300). Metrowerks reserves the right to make changes to any product described or referred to in this document without further notice. Metrowerks makes no warranty, representation or guarantee regarding the merchantability or fitness of its prod- ucts for any particular purpose, nor does Metrowerks assume any liability arising out of the application or use of any product described herein and specifically disclaims any and all liability. Metrowerks software is not authorized for and has not been designed, tested, manufactured, or intended for use in developing applications where the fail- ure, malfunction, or any inaccuracy of the application carries a risk of death, serious bodily injury, or damage to tangible property, including, but not limited to, use in factory control systems, medical devices or facilities, nuclear facilities, aircraft navigation or communication, emergency systems, or other applications with a similar degree of potential hazard. How to Contact Metrowerks Corporate Headquarters Metrowerks Corporation 7700 West Parmer Lane Austin, TX 78729 U.S.A. World Wide Web http://www.metrowerks.com Sales United States Voice: 800-377-5416 United States Fax: 512-996-4910 International Voice: +1-512-996-5300 E-mail: [email protected] Technical Support United States Voice: 800-377-5416 International Voice: +1-512-996-5300 E-mail: [email protected] Table of Contents 1 Introduction 23 Organization of Files. 23 ANSI C Standard . 25 The ANSI C Library and Apple Macintosh . 25 MSL Extras Library . 26 POSIX Functionality. 26 Console I/O and the Macintosh. 26 Console I/O and Windows. 27 Using Mac OS X and the Extras Library . 27 Compatibility . 27 Intrinsic Functions . 27 2 MSL C and Multithreading 29 Introduction to Multithreading . 29 Definitions. 30 Reentrancy Functions . 32 3 alloca.h 33 Overview of alloca.h. 33 alloca . 33 4 assert.h 35 Overview of assert.h . 35 assert . 35 5 conio.h 37 Overview of conio.h . 37 _clrscr . 38 getch . 38 getche . 39 _gotoxy . 39 _initscr. 40 MSL C Reference 1 Table of Contents inp . .40 inpd . .41 inpw . .41 kbhit. .42 outp . .42 outpd . .43 outpw . .44 _textattr . .44 _textbackground . .45 _textcolor . .45 _wherex . .46 _wherey . .46 6 console.h 49 Overview of console.h. .49 ccommand . .49 clrscr . .51 getch. .51 InstallConsole . .52 kbhit. .52 ReadCharsFromConsole . .53 RemoveConsole. .53 __ttyname . .54 WriteCharsToConsole . .54 7 crtl.h 57 Overview of crtl.h . .57 Argc . .57 Argv . .58 _DllTerminate . .58 environ . .58 _HandleTable. .59 _CRTStartup . .59 _RunInit. .60 _SetupArgs . .60 2 MSL C Reference Table of Contents 8ctype.h 61 Overview of ctype.h . 61 Character testing and case conversion. 61 Character Sets Supported . 62 isalnum . 63 isalpha . 65 isblank . 65 iscntrl. 66 isdigit. 66 isgraph . ..