am im missing something stupid?
am im missing something stupid?
Last edited by micmac700; 09-24-2006 at 06:41 PM.
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];
My best code is written with the delete key.
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.
My best code is written with the delete key.
This is the original
Last edited by micmac700; 09-24-2006 at 06:41 PM.
try that. It shouldn't make a difference thoughCode:typedef struct tty { Queue readQ, writeQ, echoQ; int echoflag; }MyTtl; MyTtl ttytab[NTTYS];
got:
tt
Last edited by micmac700; 09-24-2006 at 06:41 PM.
>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.
My best code is written with the delete key.
and the struct tty that I am adding
Last edited by micmac700; 09-24-2006 at 06:40 PM.
>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.
My best code is written with the delete key.
yea im confused on C, still learning.
Last edited by micmac700; 09-24-2006 at 06:40 PM.
>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.
My best code is written with the delete key.
so should it be
Last edited by micmac700; 09-24-2006 at 06:40 PM.
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; };
My best code is written with the delete key.
> 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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.