Which one you don't know how to do?  Getting a file name from command line,
prompting user for file name, or comparing the file name?

To access the command line, look up the argc and argv arguments that are
passed to main().

The rest depends on the language used.  But since you mentioned 'C' in your
subject...

To prompt user for file name, use fgets().

To compare file name, do you want case sensitive or insensitive compare? 

For case sensitive string compare, you have strcmp().

For case insensitive c-string compare, either your compiler provides a
non-standard stricmp() that you could use, or roll one yourself using
toupper() or tolower().

HTH
Shyan


> -----Original Message-----
> From: aavvee [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 01, 2004 1:54 AM
> To: [EMAIL PROTECTED]
> Subject: [c-prog] How to compare file name with C?
>
>
> Hi,
>
> In my program, I created a file. Then I get a file name from inline
> command.
> And I want to compare if this file name is the same as the file which I
> created. How to do this? Thanks a lot!
>
> Best,
>
> Avee
>




To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=298184.5639630.6699735.3001176/D=groups/S=:HM/A=2434971/rand=723508100


Yahoo! Groups Links

Reply via email to