[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Passing arguments instead of an input file

From: Michael Hennebry
Subject: Re: [Help-glpk] Passing arguments instead of an input file
Date: Thu, 12 Jun 2008 21:29:02 -0500 (CDT)

On Thu, 12 Jun 2008, Fábio Moura wrote:
> I have an application written in C in which the GLPK code is embebded.
> The GUI collects the problem data and writes the input file in the
> Mathprog format. Then, the program core calls the lpx_read_model
> function, which will load both the model and data. After an optimal
> solution is achieved, I treat the output.
> So, it wouldn't be needed to type the string... Instead of creating
> the input file, the program would write the problem data into the
> string. This way, I wouldn't need a permission to write.
> The system is written in C# and, as I said, the model would be in text file.

Can you use a pipe?
Edit lpx_read_model to use standard input and pipe the information to it.

You might play games with the FILE struct.
Edit lpx_read_model to edit the FILE struct after it opens a file,
any file that will open for input.
I think that you would only need to change three entries, but I'm not sure.

If lpx_read_model does all its own IO,
you could just provide it with alternative functions that use your string.
E.g. globally replace fscanf with fscanf_str.
You might get the same effect with #defines.

Michael   address@hidden
"Those parts of the system that you can hit with a hammer (not advised)
are called Hardware;  those program instructions that you can only
curse at are called Software."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]