home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16061 < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.9 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!europa.asd.contel.com!emory!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!wupost!udel!sbcs.sunysb.edu!csws11.ic.sunysb.edu!rhorn
  3. From: rhorn@csws11.ic.sunysb.edu (Robert Horn)
  4. Subject: Re: DEC VMS VERSION OF C - HOW TO ASSIGN FILE NAME?
  5. Message-ID: <1992Nov6.072147.16000@sbcs.sunysb.edu>
  6. Sender: usenet@sbcs.sunysb.edu (Usenet poster)
  7. Nntp-Posting-Host: csws11.ic.sunysb.edu
  8. Organization: State University of New York at Stony Brook
  9. References: <92310.16240634R33O7@CMUVM.CSV.CMICH.EDU>
  10. Date: Fri, 6 Nov 1992 07:21:47 GMT
  11. Lines: 28
  12.  
  13. In article <92310.16240634R33O7@CMUVM.CSV.CMICH.EDU> Robert A Rawlinson <34R33O7@CMUVM.CSV.CMICH.EDU> writes:
  14. >I HAVE A COUPLE OF STUDENTS DOING SOME C PROGRAMING FOR ME. I AM NOT A
  15. >GOOD C PROGRAMER SO I COULD NOT SEEM TO FIND THE ANSWER IN THE MANUALS.
  16. >IN COBOL I CAN CODE A FILE NAME AND THEN WHEN I RUN THE PROGRAM I CAN
  17. >ASSIGN A FILE NAME AND DIRECTORY. MY STUDENTS CODE IN C AND INDICATED THE
  18. >FILE AND DIRECTORY HAVE TO BE HARD CODED. I SUSPECT THERE IS A WAY TO
  19. >USE A NAME THAT I COULD ASSIGN A FILE AND DIRECTORY TO LATER AS IN COBOL.
  20. >COULD SOMEONE POINT ME IN THE CORRECT DIRECTION TO SOLVE THIS?
  21. >THANKS
  22. >BOB
  23. >
  24. In COBOL you're also required to use all capital letters, right? :)
  25.  
  26. the function fopen in C's standard libraries <stdio.h> takes a string which
  27. specifies the files name and a string which specifies the permisions, as such
  28.   FILE *fopen(char const *fname, char const *perm);
  29.  
  30. fname can either be hard coded into the program, or can be any string that the
  31. user has types in, or can even be some randomly generated junk if you feel so
  32. inclined. Look up fopen (and fclose while you're at it) in your favorite C
  33. book (which should be K&R 2nd Edition).
  34.  
  35. Cheers!
  36. Robb
  37.  
  38. -- 
  39. rhorn@ic.sunysb.edu           Never choose a college because it has a duckpond.
  40. Would you like to touch my wombat?          Send me hate mail, I love it.
  41.