Thanks for your info.
I already created file MyFile.txt in directory D:\Working\
And I got the file name "MyFile.txt" from command line with gets()
How to search directory D:\Working\ and find if there is a file named
"MyFile.txt"?
Thanks,
--- Shyan Lam <[EMAIL PROTECTED]> wrote:
> 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
> >
>
>
>
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
