C Programmer's Guide

C Programmer's Guide

C Programmer's Guide Part Number: 800-3844-10 Revision A of 27 March, 1990 Trademarks Sun Workstation® is a trademark of Sun Microsystems, Incorporated. SunOS1M is a trademark of Sun Microsystems, Incorporated. Copyright © 1989 Sun Microsystems, Inc. - Printed in U.S.A. All rights reserved. No part of this work covered by copyright hereon may be reproduced in any fonn or by any means - graphic, electronic, or mechanical - including photocopying, recording, taping, or storage in an infonnation retrieval system, without the prior written permission of the copyright owner. Restricted rights legend: use, duplication, or disclosure by the U.S. government is subject to restrictions set forth in subparagraph (c)(I)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 52.227-7013 and in similar clauses in the FAR and NASA FAR Supplement. The Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun ack­ nowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user inter­ faces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun's licensees. This product is protected by one or more of the following U.S. patents: 4,777,485 4,688,190 4,527,232 4,745,407 4,679,0144,435,7924,719,5694,550,368 in addition to foreign patents and applications pending. • eo: Contents Chapter 1 U sing The Sun C Compiler ...................................................................... 1 1.1. Basics - Compiling and Running C Programs ............................................ 1 1.2. C Compiler .......................................................................................................................... 3 1.3. cc Options ......................................................................................................................... 3 -a Option ........................................................................................................................ 3 -align _block_ Option ...................................................................................... 3 - B binding Option ...................................................................................................... 4 -c Option ........................................................................................................................ 4 -c Option ........................................................................................................................ 4 -dalign Option ....................................................................................................... 4 -dryrun Option ....................................................................................................... 4 - Dname [ =defJ Option .............................................................................................. 4 -E Option ........................................................................................................................ 4 Floating-Point Options .............................................................................................. 4 -g Option ........................................................................................................................ 5 -go Option ..................................................................................................................... 5 -help Option 5 - Ipathname Option ..... ".............. ,. .................................... "........... :..... ;.:;;;;; ... ;;:.;:.," ... ;~:;:.~;;, .... - J Option ........... "............................................... ......................... ;;;;;; .. ,.... i«;' •••• ; •. :;:.:;:;; ••• ;';:;;:;;.",;;.;::' -1 library Option .............. ,. ...................................... ,~~~~"':;.;.,.,:;@.~ ....: ..... ;+~~ ... ;.;.;.;:...•• , •• ,.: ....... ;;<". - L dir Option ................................................................... ·..• :.·.......... ;;,,;.,.,:,;: .. "•. ;'H~~:~.:,,;,~.;;·;;;·;i.,,,,, -MOption .................................................................................... "'....... , .. "... ;" ...... ;........ ~.,~ .. ,,'.>< -misalign Option ...................................................................... ;•• ;;;; .•. ;;:;;;.;., ... ~,.:......... .. 6 -0 output/Lie Option ................................................................................... :••• ;;; ............ .. 6 - iii- Contents - Continued -O[level] ........................................................................................................................... 6 -p Option ........................................................................................................................ 6 -P Option ........................................................................................................................ 6 -pg Option ..................................................................................................................... 6 -pic Option ................................................................................................................. 6 -PIC Option ................................................................................................................. 6 -pipe Option .............................................................................................................. 7 -Qoption prog opt Option ................................................................................ 7 -Qpa th pathnarrze Option .................................................................................. 7 -Qproduce sourcetype Option ........................................................................ 7 -R Option ........................................................................................................................ 7 -8 Option ........................................................................................................................ 7 -sb Option ..................................................................................................................... 7 target_arch Option ...................................................................................................... 7 -t emp= dir Option ................................................................................................... 7 -t ime Option .............................................................................................................. 8 -Uname Option ............................................................................................................ 8 -w Option ........................................................................................................................ 8 1.4. Environment ....................................................................................................................... 8 FLOAT_OPTION ....................................................................................................... 8 Chapter 2 Accessing a Program's Environment ............................................... 9 2.1. Basics - Accessing Command Line Arguments ......................................... 9 2.2. Basics - Accessing Environment Variables .................................................. 10 Accessing Environment Variable Using getenv () ............................ 11 Chapter 3 Processes ................................................................................................................ 13 3.1. The system () Function ......................................................................................... 13 3.2. Low-Level Process Creation - execl () and execv () ................ 13 3.3. Process Control- fork () and wait () .................................................. 15 3.4. Pipes ........................................................................................................................................ 16 Chapter 4 Signals - Interrupts and All That ...................................................... 21 -iv- Contents - Continued Chapter 5 The Standard I/O Library .......................................................................... 27 5.1. The Standard I/O Library ............................................................................................ 27 5.2. Using the Standard I/O Library ............................................................................... 27 5.3. The Standard Input and Standard Output .......................................................... 29 Reading Standard Input and Writing Standard Output ........................... 29 5.4. ErrorHandling- stderrand exit() .................................................... 31 5.5. Miscellaneous 110 Functions .................................................................................... 31 Chapter 6 Accessing Files Through Standard I/O ........................................... 33 6.1. Accessing Files ................................................................................................................. 36 fopen () - Open a File ...................................................................................... 36 freopen () - Reopen a File ........................................................................... 37 fflush () - Flush Stream Buffer ................................................................ 37 fclose () - Close A File ................................................................................. 38 setbuf () - Set Buffer for File I/O ..........................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    108 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us