www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/24/15:16:07

Date: Tue, 24 Feb 1998 13:10:59 -0700
From: Mike Williams <mikewilliams3 AT mci2000 DOT com>
Subject: [Fwd: HELP!!!!]
To: djgpp AT delorie DOT com, eldredge AT ap DOT net
Reply-to: mikewilliams3 AT mci2000 DOT com
Message-id: <34F32952.DE60585A@mci2000.com>
MIME-version: 1.0

This is a multi-part message in MIME format.

--Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit



--Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA)
Content-type: MESSAGE/RFC822

Date: Tue, 24 Feb 1998 12:59:48 -0700
From: Mike Williams <mikewilliams3 AT mci2000 DOT com>
Subject: Re: HELP!!!!
To: Nate Eldredge <eldredge AT ap DOT net>
Cc: eldredge AT ap DOT com, djgpp AT delorie DOT com
Reply-to: mikewilliams3 AT mci2000 DOT com
Message-id: <34F326B4 DOT C017CE1B AT mci2000 DOT com>
MIME-version: 1.0
X-Mailer: Mozilla 4.02 [en] (Win95; I)
Content-type: MULTIPART/ALTERNATIVE;
 BOUNDARY="Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)"
X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; uuencode=0; html=0;
 linewidth=80
References: <199802110532 DOT VAA05847 AT adit DOT ap DOT net>


--Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit

   Nate Eldredge wrote:

> At 12:29  2/10/1998 -0700, Mike Williams wrote:
> >Hope somebody can help me. I'm a real newbie to 'C' programming, trying
> >to teach myself with your fine software and a copy of "C for
> >Dummies"...an appropriate choice...:)
> >       The first lesson is how to compile, link and run a simple
> >(really, really simple) source file and produce an .exe file. It appears
> >to work, and produces an exe file, and doing an [ALT F5] shows an output
> >screen with the text as it should be. Once it's compiled, I get an "Exit
> >code 17" or "Exit code 22" in Rhide, but although it says "no errors" in
> >the lower window, it also says Access denied. I don't know if these
> >messages are normal; I didn't find anything in a quick look over the
> >FAQ's. My problem is that if I try to run it from the DOS prompt, it
> >says "program too big to load". I have plenty of spare RAM, both
> >conventional and extended, and the program size is 78Kb. I've tried it
> >on 3 different PC's now; a 486/66, Dos 6.2: a486 DX4/100 running Win95,
> >and a full-blown Pentium 220MMX. I've tried starting in DOS, or invoking
> >the DOS prompt from Windows, and I get the same message on all 3 PC's.
> I don't know about the "too big to load" message. It's come up a few times
> and I never heard what the cause or the solution was. Try these:
> * Compile your file from the command line:
>   gcc -o foo.exe foo.c
> I did that.
> and see if it works then.
> No difference
> * Make sure you are using DJGPP v2.01, the latest version.Got that!
> * Scan for viruses, file corruptions, etc.
> None!
> * If none of these helps, post again. I have some more specific ideas about
> finding the problem.
> In any case, if you find what caused or fixed this problem, please post a
> summary so your solution can help other people.
>
> Read on for the fix to the "Exit code 22" problem.
> >Any ideas?
> >       This is the source file:
> >#include <stdio.h>
> >
> >void main()
> >{
> >       printf("GO AWAY, MORON!\n");
> >}
> This is wrong. According to ANSI C, the `main' function must return an
> `int'. If not, behavior is "undefined" and usually results in funny return
> codes. If there were no errors, that return value should be 0. Correct code:
>
> #include <stdio.h>
>
> int main(void)
> {
>    printf("Hello, world\n"); /* more friendly :) */
>    return 0;
> }                                                               Thanks, that
> fixed the error exit problem.

> I think you should get rid of the Dummies book. Their examples are no good,
> and that doesn't help at all. Someone else, here or on comp.lang.c, might be
> able to recommend a better one. You might also check the comp.lang.c FAQ.
> (_The_C_Programming_Language,_Second_Edition_ is recommended frequently and
> is practically the definitive reference, but I don't know how well it works
> as a tutorial. The First Edition wasn't bad...)
>
> Nate Eldredge
> eldredge AT ap DOT net

 Thanks for the input..now I hope you can help again. If I compile and run the
program, it works from within rhide,as before, but as soon as it has run, the
bottom window has the following message:-
permission denied (EACCESS)
no errors
As Christian (ChrHenz AT aol DOT com) and you  suggested earlier, I have experimented
with using "int main()" instead of the original "void main()" as  instructed by
the rather silly C for Dummies book from which I'm trying to learn C.
Unfortunately, the office budget will not run to a "proper" book  Also,
including the "return 0;" statement took care of the exit error problem. I still
can't get the blasted thing to run outside Rhide, though...still the "too big to
load" error. Something else I noticed is that if I try to run it from within
Win95, instead of opening a DOS window, as other DOS files do, it says "this is
not a valid win32 program"
    None of these errors are fatal, or anything, because I'm still learning C,
and as long as they work from within Rhide, I know the source code is working.
It's just that once I start writing "real" programs, it would be nice if they
would actually run independently! Still, at the rate I'm progressing, that day
is still a long way off, however eager my boss is that I start editing some
applications!

Thanks for your help!

Mike


--Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)
Content-type: text/html; charset=us-ascii
Content-transfer-encoding: 7bit

<HTML>
&nbsp;&nbsp; Nate Eldredge wrote:
<BLOCKQUOTE TYPE=CITE>At 12:29&nbsp; 2/10/1998 -0700, Mike Williams wrote:
<BR>>Hope somebody can help me. I'm a real newbie to 'C' programming, trying
<BR>>to teach myself with your fine software and a copy of "C for
<BR>>Dummies"...an appropriate choice...:)
<BR>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The first lesson is how to compile,
link and run a simple
<BR>>(really, really simple) source file and produce an .exe file. It appears
<BR>>to work, and produces an exe file, and doing an [ALT F5] shows an
output
<BR>>screen with the text as it should be. Once it's compiled, I get an
"Exit
<BR>>code 17" or "Exit code 22" in Rhide, but although it says "no errors"
in
<BR>>the lower window, it also says Access denied. I don't know if these
<BR>>messages are normal; I didn't find anything in a quick look over the
<BR>>FAQ's. My problem is that if I try to run it from the DOS prompt,
it
<BR>>says "program too big to load". I have plenty of spare RAM, both
<BR>>conventional and extended, and the program size is 78Kb. I've tried
it
<BR>>on 3 different PC's now; a 486/66, Dos 6.2: a486 DX4/100 running Win95,
<BR>>and a full-blown Pentium 220MMX. I've tried starting in DOS, or invoking
<BR>>the DOS prompt from Windows, and I get the same message on all 3 PC's.
<BR>I don't know about the "too big to load" message. It's come up a few
times
<BR>and I never heard what the cause or the solution was. Try these:
<BR>* Compile your file from the command line:
<BR>&nbsp; gcc -o foo.exe foo.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<FONT COLOR="#3333FF">I did that.</FONT>
<BR>and see if it works then.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#3333FF">
No difference</FONT>
<BR>* Make sure you are using DJGPP v2.01, the latest version.<FONT COLOR="#3333FF">Got
that!</FONT>
<BR>* Scan for viruses, file corruptions, etc.<FONT COLOR="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
None!</FONT>
<BR>* If none of these helps, post again. I have some more specific ideas
about
<BR>finding the problem.
<BR>In any case, if you find what caused or fixed this problem, please
post a
<BR>summary so your solution can help other people.

<P>Read on for the fix to the "Exit code 22" problem.
<BR>>Any ideas?
<BR>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is the source file:
<BR>>#include &lt;stdio.h>
<BR>>
<BR>>void main()
<BR>>{
<BR>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("GO AWAY, MORON!\n");
<BR>>}
<BR>This is wrong. According to ANSI C, the `main' function must return
an
<BR>`int'. If not, behavior is "undefined" and usually results in funny
return
<BR>codes. If there were no errors, that return value should be 0. Correct
code:

<P>#include &lt;stdio.h>

<P>int main(void)
<BR>{
<BR>&nbsp;&nbsp; printf("Hello, world\n"); /* more friendly :) */
<BR>&nbsp;&nbsp; return 0;
<BR>}<FONT COLOR="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thanks, that fixed the error exit problem.</FONT></BLOCKQUOTE>

<BLOCKQUOTE TYPE=CITE>I think you should get rid of the Dummies book. Their
examples are no good,
<BR>and that doesn't help at all. Someone else, here or on comp.lang.c,
might be
<BR>able to recommend a better one. You might also check the comp.lang.c
FAQ.
<BR>(_The_C_Programming_Language,_Second_Edition_ is recommended frequently
and
<BR>is practically the definitive reference, but I don't know how well
it works
<BR>as a tutorial. The First Edition wasn't bad...)

<P>Nate Eldredge
<BR>eldredge AT ap DOT net</BLOCKQUOTE>
<FONT COLOR="#3333FF">&nbsp;Thanks for the input..now I hope you can help
again. If I compile and run the program, it works from within rhide,as
before, but as soon as it has run, the bottom window has the following
message:-</FONT>
<BR><FONT COLOR="#3333FF">permission denied (EACCESS)</FONT>
<BR><FONT COLOR="#3333FF">no errors</FONT>
<BR><FONT COLOR="#3333FF">As Christian (ChrHenz AT aol DOT com) and you&nbsp;
suggested earlier, I have experimented with using "int main()" instead
of the original "void main()" as&nbsp; instructed by the rather silly C
for Dummies book from which I'm trying to learn C. Unfortunately, the office
budget will not run to a "proper" book&nbsp; Also, including the "return
0;" statement took care of the exit error problem. I still can't get the
blasted thing to run outside Rhide, though...still the "too big to load"
error. Something else I noticed is that if I try to run it from within
Win95, instead of opening a DOS window, as other DOS files do, it says
"this is not a valid win32 program"</FONT>
<BR><FONT COLOR="#3333FF">&nbsp;&nbsp;&nbsp; None of these errors are fatal,
or anything, because I'm still learning C, and as long as they work from
within Rhide, I know the source code is working. It's just that once I
start writing "real" programs, it would be nice if they would actually
run independently! Still, at the rate I'm progressing, that day is still
a long way off, however eager my boss is that I start editing some applications!</FONT>

<P><FONT COLOR="#3333FF">Thanks for your help!</FONT>

<P><FONT COLOR="#3333FF">Mike</FONT>
<BR>&nbsp;&nbsp;</HTML>

--Boundary_(ID_qYe9o6NbGJO5451PNdRgjg)--

--Boundary_(ID_d4djw4VZG6wbN7gD2J1yJA)--

- Raw text -


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