From: "Böhme Uwe" Newsgroups: comp.os.msdos.djgpp Subject: Re: please help {newbie} Date: Wed, 29 Jul 1998 12:57:40 +0200 Organization: Bingo (Buergernetz Ingolstadt eV) Lines: 24 Message-ID: <35BF0024.B4BCDF87@hof.baynet.de> References: <6pmncl$pph$1 AT osprey DOT global DOT co DOT za> NNTP-Posting-Host: port29.hof.baynet.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk > how do i read a file name to the program in the calling statement i.e. > "c:\resolve test.txt" > > thanks > heinrich If a program is called with command line arguments (or without) you'll get two parameters passed to your main() int main(int argc, char *argv[]) The argc argument keep the number of command line arguments (at least 1, even if no argument is specified), argv[0] is a pointer to a string wich is holding the path of the exe file itself (i.e. "c:\resolve.exe"). In your example argc would be 2 and argvc[1] would point to "test.txt". Additional arguments increase argc and the n'th argument can be read by argv[ n - 1 ]. Good luck Uwe