www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/17/11:58:54

From: "Al Morgan" <muaddib AT proaxis DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with my program
Date: Tue, 17 Aug 1999 04:12:19 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 61
Message-ID: <rrigqe203uk46@corp.supernews.com>
References: <7pa565$sq1$1 AT nnrp1 DOT deja DOT com>
X-Complaints-To: newsabuse AT supernews DOT com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You should also include the exact error you got?  I don't know if it didn't
compile, or it compiled fine, but didn't work, or what.  I'm pretty sure the
PATH cariavle in the AUTOEXEC.BAT will only look for .bat, .exe, and .com
files, so you can't put your source there.  I wouldn't reccomend putting all
your source files in the djgpp/bin directory, there's so much stuff there,
you'll have trouble sorting your files from the DJGPP files.  Personally, I
have a directory called djgpp/proj, where I put all my stuff, and I make a
new directory off that one for each major project I do.

As for your program:

I'm pretty sure you can't "   InA >> i   ", like you did.  Try "
InA.getling(i, 80)   ".  (80 is the buffer size).  Also, make sure you are
compiling with gxx, or else file streams like that won't work (at least they
didn't for me).  As for C file routines, I'd like to know just as much as
you.  I learned C++ from a book, and it didn't even touch C file routines,
just streams.

I hope this helped
    Al [muaddib AT proaxis DOT com]


JustinFL <justinfl AT netzero DOT net> wrote in message
news:7pa565$sq1$1 AT nnrp1 DOT deja DOT com...
> I'm having trouble reading text from a file.  I was told to give my
> program example and you guys would help.  What i'd like to know is why
> this program isn't outputting a line of text from a file.  the file does
> exist, i didn't add the check for file thing in there to keep it short.
> But how come this isn't working.  Also, someone told me that it's not
> good to use streams because they're not as good as the C routines for
> reading text from a file.  I'd like some input on that.  Also, I keep
> all my source files in /justin/djgpp/bin  .....is that where you all
> would recommend me keeping them.  Occasionally I'll have a message pop
> up saying the compiler couldn't find my source code.  If i add a path
> command to my autoexec.bat file, shouldn't the compiler be able to find
> the source anywhere within the PATH='s specifications.  These aren't big
> problems, but I really want to know how to make the source code below
> work how i want it to......:
>
> file://Start here
> cout << "File.ext (12 chars max): ";
> cin >> infile;
> ifstream inA(infile);
>
> if (inA)
>    cout << "File opened correctly, proceeding with execution" << endl;
> else
>    cout << "File was not opened correctly" << endl;
>
> char i[80];
>
> inA >> i;
> cout << i;
> inA.close();
> file://Ends here
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019