Just for clarification:

strcpy (bfield_data.best_ratio.name, fread_string (fp));

Or did you mean:

char *tmp;
tmp = fread_string (fp);
strcpy (bfield_data.best_ratio.name, tmp);

Actually, those two above may more or less do the same thing.

Not sure, though. :-)

----- Original Message -----
From: "Edwin Groothuis" <[EMAIL PROTECTED]>
To: "Jeremy Hill" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Thursday, July 11, 2002 11:31 PM
Subject: Re: reading from files, fread_string


> On Thu, Jul 11, 2002 at 11:25:49PM -0500, Jeremy Hill wrote:
> > Howdy once again.
> >
> > Structure:
> > struct  {
> > ...
> >    struct
> >    {
> >       char name[MAX_INPUT_LENGTH];
> >    } best_ratio;
> > ...
> > } bfield_data;
> >
> >
> > When reading from a file, this isn't working:
> > bfield_data.best_ratio.name = fread_string (fp);
> >
> > (bfio.c:192: incompatible types in assignment)
> >
> > How can I get around this?  I'm trying to steer away from using pointers on
the
> > structure itself as I am inexperienced with them.  Any ideas?
>
> use strcpy() here. Keep in mind that you should throw away the
> return pointer afterwards anyway.
>
> Edwin
> --
> Edwin Groothuis      |           Personal website: http://www.MavEtJu.org
> [EMAIL PROTECTED]    |        Interested in MUDs? Visit Fatal Dimensions:
> bash$ :(){ :|:&};:   |                    http://www.FatalDimensions.org/
>


Reply via email to