home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13587 < prev    next >
Encoding:
Text File  |  1992-09-12  |  1.2 KB  |  46 lines

  1. Path: sparky!uunet!utoday!jaflrn!jaf
  2. From: Jon Freivald <jaf@jaflrn.UUCP>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Command Line Arguments
  5. Message-ID: <6o6yqB1w164w@jaflrn.UUCP>
  6. Date: Sat, 12 Sep 92 02:11:04 EDT
  7. References: <18intpINNif6@usenet.INS.CWRU.Edu>
  8. Organization: The Wizzard's Cave, East Meadow, NY
  9. Lines: 35
  10.  
  11. bx314@cleveland.Freenet.Edu (Joseph J. Gebis) writes:
  12.  
  13. >     I would like to know how to pass command line arguments in DOS
  14. > to a separate function...  I would greatly appreciate if someone
  15. > would write an example of a program that passes command line arguments
  16. > to a separate function that then prints them on screen.
  17. >     Remember, I'm self-taught, and a beginner, so speak slowly
  18. > and loudly. :)
  19. >     Thank you very much.
  20.  
  21. #include <stdio.h>
  22.  
  23. int main ( int argc, char **argv )
  24.  
  25. {
  26.     int i;
  27.  
  28.     for ( i=0 ; i < argc ; i++ )
  29.         {
  30.         show_me(argv[i]);
  31.         }
  32. }
  33.  
  34. void show_me (char *argv_i)
  35.  
  36. {
  37.     printf ("Arg: %s", argv_i);
  38. }
  39.  
  40. =============================================================================
  41.            Jon Freivald ( jaflrn!jaf@uunet.UU.NET )
  42.      Nothing is impossible for the man who doesn't have to do it.
  43. =============================================================================
  44.