am im missing something stupid?
Printable View
am im missing something stupid?
You're defining a struct, not a variable. It can't be an array. Perhaps something more like this:
Code:struct tty {
Queue readQ, writeQ, echoQ;
int echoflag;
};
struct tty ttytab[NTTYS];
with that fix i get this error
tty.c:232: warning: file does not end in newline
tty.c:18: redefinition of `struct tty'
>tty.c:232: warning: file does not end in newline
Put your cursor after the last character in the file and hit Enter.
>tty.c:18: redefinition of `struct tty'
Post your code, please.
This is the original
try that. It shouldn't make a difference thoughCode:typedef struct tty {
Queue readQ, writeQ, echoQ;
int echoflag;
}MyTtl;
MyTtl ttytab[NTTYS];
got:
tt
>got:
When I asked for code, I meant more than what you originally offered. Shrink your program down to something small that still gives you the errors and then cut and paste the entire files. Most of the time, having just the error is useless in debugging. You need both the error and all of the code around the line that the error refers to.
and the struct tty that I am adding
>and the struct tty that I am adding queues to is from file tty.c right after the includes
It should be the struct tty that's already defined in tty.h. It sounds like you're adding another definition, which coincides with the error you're getting.
yea im confused on C, still learning.
>So i'm not sure what to do with the ttytabs array
Leave it as is. You only need to change the definition of the structure, not any variables of the structure. Of course, how the variables are used will likely change, but that's not relevant to this particular problem.
so should it be
Don't worry about the typedef. Just this:
And be aware that if that's the only change to the code you've linked to, you'll get slews of errors because the members of the tty struct have changed. So please don't come running to us when you get stuff like "rbuf undeclared identifier", k? :)Code:struct tty {
Queue readQ, writeQ, echoQ;
int echoflag;
};
> Last edited by micmac700 : Today at 01:40 AM.
Please don't edit your posts down to nothing when you feel you've got an answer.
Not only does it make following replies look stupid, there is no way for people who come along later to get any idea of what the hell's going on.