PLUG-devel digest, Vol 1 #257 - 2 msgs

Bryce C plug-devel@lists.PLUG.phoenix.az.us
Tue Jan 7 22:37:02 2003


--=-lKrfC//3TeVzxYeAkxTq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Of course.  How obvious!  Even a novice would have sen that.  Thanks.=20
Guess I just didn't have enough caffeine in my system.

On Tue, 2003-01-07 at 12:00, plug-devel-request@lists.PLUG.phoenix.az.us
wrote:
> Send PLUG-devel mailing list submissions to
> 	plug-devel@lists.PLUG.phoenix.az.us
>=20
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel
> or, via email, send a message with subject or body 'help' to
> 	plug-devel-request@lists.PLUG.phoenix.az.us
>=20
> You can reach the person managing the list at
> 	plug-devel-admin@lists.PLUG.phoenix.az.us
>=20
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PLUG-devel digest..."
>=20
>=20
> Today's Topics:
>=20
>    1. Program Question (Bryce C)
>    2. Re: Program Question (Matt Porter)
>=20
> --__--__--
>=20
> Message: 1
> Subject: Program Question
> From: Bryce C <Plug@BryceCo.Net>
> To: plug-devel@lists.PLUG.phoenix.az.us
> Organization: CoBryce Communications
> Date: 06 Jan 2003 16:11:55 -0700
> Reply-To: plug-devel@lists.PLUG.phoenix.az.us
>=20
>=20
> --=3D-GsO0pbs1MlrfuP68nF4G
> Content-Type: text/plain
> Content-Transfer-Encoding: quoted-printable
>=20
> Can anyone tell me why there is always a segfault at the end of this?
>=20
> <!-- Starting -->
>=20
> #include <iostream.h>
> using namespace std;
>=20
> int main(int argc, char *argv[])
>=20
> {
> 	if(argc<2)
> 	{
> 			cout << "Don't waste my time!\n";
> 			return(1);
> 	}
> 	for(int i=3D3D1; i<=3D3D argc; i++)
> 			cout << argv[i][0] << ": " << int(argv[i][0]) << '\n';
> 	return (0);
> }
>=20
>=20
> <!-- Ending -->
>=20
> ./src/ch h f
> h: 104
> f: 102
> Segmentation fault
>=20
>=20
> --=3D20
> Bryce C <Plug@BryceCo.Net>
> CoBryce Communications
>=20
> --=3D-GsO0pbs1MlrfuP68nF4G
> Content-Type: application/pgp-signature; name=3Dsignature.asc
> Content-Description: This is a digitally signed message part
>=20
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>=20
> iD8DBQA+Gg07/wbq/C6yyPcRArITAJ9swGu6K/h0IjTvPgAQpgvuY9F8ygCgiI3O
> NxAvu5osMQv37iJmUDicy/M=3D
> =3DJrrr
> -----END PGP SIGNATURE-----
>=20
> --=3D-GsO0pbs1MlrfuP68nF4G--
>=20
>=20
> --__--__--
>=20
> Message: 2
> Date: Mon, 6 Jan 2003 16:55:30 -0700
> From: Matt Porter <porter@cox.net>
> To: plug-devel@lists.PLUG.phoenix.az.us
> Subject: Re: Program Question
> Reply-To: plug-devel@lists.PLUG.phoenix.az.us
>=20
> On Mon, Jan 06, 2003 at 04:11:55PM -0700, Bryce C wrote:
> > Can anyone tell me why there is always a segfault at the end of this?
>=20
> <snip>
>=20
> > 	for(int i=3D1; i<=3D argc; i++)
>                      ^^^^^^^^^
> It's overrunning the argv array.
>=20
> Should be:
>=20
>  	for(int i=3D1; i< argc; i++)
>=20
> Regards,
--=20
Bryce C <Plug@BryceCo.Net>
CoBryce Communications

--=-lKrfC//3TeVzxYeAkxTq
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA+G7Zs/wbq/C6yyPcRAg2aAJ4oI/ggMZSMgp64BBU5ADK+M/NM/ACgiDMH
88avW5kLO6961tCf/tLovVI=
=cqnF
-----END PGP SIGNATURE-----

--=-lKrfC//3TeVzxYeAkxTq--