Tom St Denis
2/9/2011 5:12:00 PM
On Feb 9, 7:12 am, "Bill Cunningham" <nos...@nspam.invalid> wrote:
> sread is supposed to take as it's parameter one value at a time and and put
> it into the struct stk type called name. I obviously don't remember how to
> do it correctly or neverlearned right. Hence my inexperience with structs.. I
> do believe I can do this with pointers though.
Except that in your example you provided as input a struct and
returned a struct, then your mock code copied elements out of a
struct. That's clearly not what you're trying to do.
What I don't get is why you bother trolling clc. If you were actually
trying to accomplish something you'd organize your thoughts and work a
lot better than you do. Instead, you just post random snippets of
whatever goof off material springs to mind.
> struct stk name;
>
> name.date=020811;
> name.price=20.00; //In USD.
You're sticking a floating point value in an unsigned int. Really?
> name.volume=232987;
>
> This is how I would load a struct. Now swrite is supposed to do that for
> me. Instead of typing all this manually, I want to pass to swrite data and
> have swrite write it into the struct. sread would fetch it back. Simple
> concept. I don't know for sure how to code it.
Writing it should be easy, e.g.
void swrite(struct stk *dst, TYPE date, TYPE price, TYPE volume);
Or even
struct stk swrite(TYPE date, TYPE price, TYPE volume);
As for sread, that's a bit harder since you're trying to read out the
elements serially you either need multiple pointers like
void sread(struct stk *src, TYPE *date, TYPE *price, TYPE *volume);
Or you need to specify WHICH member you want to return. But what you
REALLY need to do is stop trolling USENET.
Tom