Okay I will try that.  

Does a c executable not read from a default directory?  Say the one in which 
the executable resides?

What about relative paths such as ".\teapot.txt"?



--- In c-prog@yahoogroups.com, Brett McCoy <idragos...@...> wrote:
>
> On Tue, Feb 23, 2010 at 9:22 AM, Jimmy Johnson <boxer...@...> wrote:
> 
> > Using visual studio 2008 express...
> >
> > I can not open a file; f.is_open() is false.
> >
> > ifstream f;
> > int num_patches;
> >
> > f.open ("teapot.txt");
> > if (f.is_open()) {
> >        while (! (f.eof())) {
> >                f >> num_patches;
> > ...
> >
> > So where do I put the "teapot.txt" file?  I have tried several directories.
> >
> > Perhaps there's another problem?  I'm new to c.
> 
> It's not a question of where you put the file, it's a question of
> telling your program where it is. You need to give the full path to
> the file, not just the filename.
> 
> -- Brett
> ------------------------------------------------------------
> "In the rhythm of music a secret is hidden;
>     If I were to divulge it, it would overturn the world."
>                -- Jelaleddin Rumi
>


Reply via email to