On 2/21/07, Mongi <[EMAIL PROTECTED]> wrote:

> That is correct Brett.  The file1 is derived from a fe solution and
> contains new data.  The file1 contains over a 500 statements that
> assign data to variables used by file2... Imagine having to write down
> all these fscanf() statements, its not practical...  When I use
> #include "file1" within the file2 program (which actually works within
> the body of the program provided that file1 contains valid
> C-statetments and that all vars are declared), the changes in file1
> are not taken, and it will only keep using the original info from the
> first execution, which makes sense now that I think about it.  Anyway,
> I need to find a way to do this with a dynamically changing file1 like
> u said.  I found an equivalent to what I want to in python script
> where u simply write execfile(file1).  I thought C would have this
> feature too.

You can do this in interpreted languages like Python or Perl, but
since C is a compiled language, you can't just read in source code
statements and expect to execute them during runtime... you'd need an
embedded C interpreter. Why not just make the file a textfile of data
that you open, read via a loop and assign to your variables and or
data structures? Why would you need 500 fscanf() statements? What is
the structure of the data?

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to