--- In [EMAIL PROTECTED], "Thomas J. Hruska" <[EMAIL PROTECTED]>
wrote:
> At 12:39 AM 12/26/2004 -0000, dragtriumph writeth:
> >OK, I'm new here and new to C. I'm using the DJGPP (GNU) setup to
> >learn C. I'm having some difficulty accessing a structure ,which
I
> >believe I defined globally, inside a function.
>
> Wow. I didn't think anyone used DJGPP still. It is an "okay"
> middle-ground between DOS and Windows without actually being able
to make
> Windows calls, but gets you a flat 32-bit protected mode memory
model.
>
Thanks Tom. I think maybe I didn't ask the question correctly. And,
a lot of those &'s and *'s were after a lot of frustrating attempts
trying to follow examples in books which weren't really doing what I
wanted to do. I was just trying things to see if I could get
ANYTHING to work! Let's try staring from the beginning.
These are the files I'm working with:
386_XXXX C x86 routines
386_XXXX H
DOS_XXXX C DOS interface routines
DOS_XXXX H
DOS_BAT BAT make file stuff
DOS_MAK BAT
DOS_XXXX MAK
ENG_XXXX C basic engine info and formulas
ENG_XXXX H
ENV_XXXX C basic environment info and formulas
ENV_XXXX H
BM_XXXX C basic math info and formulas
BM_XXXX H
INT_XXXX C intake info and formulas
INT_XXXX H (NOW INACTIVE)
CMB_XXXX C combustion chamber info and formulas
CMB_XXXX H
EXH_XXXX C exhaust info and formulas
EXH_XXXX H (NOW INACTIVE)
The ENG, ENV, BM, INT, CMB and EXH files will eventually become a
library (I hope! ;-)). Just to prove that my formulas work, I'm
putting a DOS face on it right now. Trying to keep things simple.
In the ENG file, I want to define a structure containing basic info
about an engine:
struct engine {
float bore;
float stroke;
float con_rod_len;
unsigned short num_cyl;
float comp_ratio;
float int_open;
float int_close;
float int_valve_lift;
float int_valve_dia;
unsigned short num_int_valve;
float int_port_dia;
float exh_open;
float exh_close;
float exh_valve_lift;
float exh_valve_dia;
unsigned short num_exh_valve;
float exh_port_dia;
float carb_thr_size;
unsigned short num_carb;
char note_1[70];
char note_2[70];
char note_3[70];
char note_4[70];
char note_5[70];
};
This info will eventually be saved to a file. At the same time, I
need to have this info accessible to a lot of functions in the BM,
INT, CMB and EXH files.
What I'm looking for is how to make this a global structure and how
to access it from any point/function in my program. I've tried
everything the books I have ("C for Dummies", vols. 1 and 2, "Teach
Yourself C in 24 Hours") had in them with no success. But like I
said, there are no examples in them of what I'm trying to do.
There. I think I've state my problem much more clearly. Sorry about
the false start.
Willy
********************************************************************
Keller Racing
Performance by Design
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.bylleet.com/kz_racing
http://ourworld.compuserve.com/homepages/nostalgia_drag_bike
http://groups.yahoo.com/group/keller_racing
eBAY User ID: kz_racing
SUPPORT YOUR LOCAL DRAG RACER!!
********************************************************************
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
