Re: System.ini Loading/Writing

From: RUSSELL BROWN (russelltbrown@msn.com)
Date: 06/12/02


The problem you are having is with the scope of System. When a variable
is declared locally, like you have done with System, it only "exists"  
within the function where it is declared. The struct SystemData you have
allocated with the CREATE macro is still there, but the program can't see
it once you exit the function LoadSystemIni since the program no longer  
recognizes the pointer variable. You get the error about System being  
unitialized in do_systeminfo because you have redeclared it locally within
that function, but you have not set it value to anything.

You need to declare the System pointer globally so that you can access it
in the entire program. Move your declaration command:

struct SystemData *System;

into one of the .h header files. db.h may be a good choice. Then make  
sure that .h file is included in any file where you want to use the pointer.
Also don't declare the pointer locally in a function unless you want to  
use the local version instead of the global one.  

Russ

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT