C problems
Deven Corzine
deven at rpi.edu
Tue May 30 17:34:57 AEST 1989
In article <May.29.21.40.18.1989.8866 at topaz.rutgers.edu> armhold at topaz.rutgers.edu (George Armhold) writes:
I started using my C compiler today (Manx Aztec V3.6a), and I'm really
frustrated with I/O.
Poor guy... you'll surely be baffled by Amiga Exec I/O...
Also, here's some source I tried today. What I'm trying to do is
simply copy one file to another. When I compile it, I get error 125
which means "too many subscripts or indirection on integer". It occurs
wherever I mention argv[x].
#include <stdio.h>
main(argc, argv)
{
[...]
This error has nothing to do with the I/O; you never declared what the
parameters rto main were, so the compiler assumed integer for both.
argc is an integer, but argv is a char **. You need to add a line
after main(argc,argv) but BEFORE the "{" which reads "char **argv;" or
"char *argv[];" (take your pick; they mean the same.) and you *should*
add right before it "int argc;" but you don't need to, since the
compiler will assume it.
It thought argv was an integer, and argv[x] was the indirection on
integer causing the error.
Deven
--
shadow@[128.113.10.2] <shadow at pawl.rpi.edu> Deven T. Corzine (518) 272-5847
shadow@[128.113.10.201] <shadow at acm.rpi.edu> 2346 15th St. Pi-Rho America
deven at rpitsmts.bitnet <userfxb6 at rpitsmts> Troy, NY 12180-2306 <<tionen>>
"Simple things should be simple and complex things should be possible." - A.K.
More information about the Comp.lang.c
mailing list