home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- 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
- From: rhorn@csws11.ic.sunysb.edu (Robert Horn)
- Subject: Re: DEC VMS VERSION OF C - HOW TO ASSIGN FILE NAME?
- Message-ID: <1992Nov6.072147.16000@sbcs.sunysb.edu>
- Sender: usenet@sbcs.sunysb.edu (Usenet poster)
- Nntp-Posting-Host: csws11.ic.sunysb.edu
- Organization: State University of New York at Stony Brook
- References: <92310.16240634R33O7@CMUVM.CSV.CMICH.EDU>
- Date: Fri, 6 Nov 1992 07:21:47 GMT
- Lines: 28
-
- In article <92310.16240634R33O7@CMUVM.CSV.CMICH.EDU> Robert A Rawlinson <34R33O7@CMUVM.CSV.CMICH.EDU> writes:
- >I HAVE A COUPLE OF STUDENTS DOING SOME C PROGRAMING FOR ME. I AM NOT A
- >GOOD C PROGRAMER SO I COULD NOT SEEM TO FIND THE ANSWER IN THE MANUALS.
- >IN COBOL I CAN CODE A FILE NAME AND THEN WHEN I RUN THE PROGRAM I CAN
- >ASSIGN A FILE NAME AND DIRECTORY. MY STUDENTS CODE IN C AND INDICATED THE
- >FILE AND DIRECTORY HAVE TO BE HARD CODED. I SUSPECT THERE IS A WAY TO
- >USE A NAME THAT I COULD ASSIGN A FILE AND DIRECTORY TO LATER AS IN COBOL.
- >COULD SOMEONE POINT ME IN THE CORRECT DIRECTION TO SOLVE THIS?
- >THANKS
- >BOB
- >
- In COBOL you're also required to use all capital letters, right? :)
-
- the function fopen in C's standard libraries <stdio.h> takes a string which
- specifies the files name and a string which specifies the permisions, as such
- FILE *fopen(char const *fname, char const *perm);
-
- fname can either be hard coded into the program, or can be any string that the
- user has types in, or can even be some randomly generated junk if you feel so
- inclined. Look up fopen (and fclose while you're at it) in your favorite C
- book (which should be K&R 2nd Edition).
-
- Cheers!
- Robb
-
- --
- rhorn@ic.sunysb.edu Never choose a college because it has a duckpond.
- Would you like to touch my wombat? Send me hate mail, I love it.
-