SWMM 5, InfoSWMM, H20MAP SWMM, InfoSewer for Water Quality,Hydrology, Hydraulics
Robert Dickinson commented on Robert Dickinson's group Stream of Information
Robert Dickinson replied to Robert Dickinson's discussion How is the St Venant Equation Solved for in the Dynamic Wave Solution of SWMM 5?
Robert Dickinson left a comment for wu ze jian
Robert Dickinson posted a discussion
Robert Dickinson added a page to the group Hydraulics
Robert Dickinson's blog post was featured
Robert Dickinson posted a blog post
Robert Dickinson commented on Robert Dickinson's group Stream of Information
Robert Dickinson commented on Robert Dickinson's group Stream of Information
Robert Dickinson commented on Robert Dickinson's group Water Quality
Robert Dickinson commented on Robert Dickinson's group Water Quality
MeHa commented on Robert Dickinson's group Water Quality
MeHa posted a status
Quah Soon Tong left a comment for Esther Bergareche Auricenea
Robert Dickinson commented on Robert Dickinson's group Stream of Information
Robert Dickinson commented on Robert Dickinson's group Stream of InformationHi,
I have linked SWMM 5.0 with an optimization module and using C++.
I wanted to print some results from the simulation to an external text file.
I've used the following codes, however, I can't get the results printed. Instead of that I am just getting printed "STO[0]" inside the text file.
Could anyone help me on this issue?
float STO[100];
FILE*f4;
OpenSwmmOutFile("f3.out");
for(t=1; t<=1; t++)
{
GetSwmmResult(3, 0, 12, t, &STO[0]);
f4=fopen("f4.txt", "w");
fprintf (f4, "STO[0]");
fclose(f4);
}
CloseSwmmOutFile();
Is this the correct way to print results in an external file?
Thanks a lot.
Tags:
Permalink Reply by Robert Dickinson on October 13, 2011 at 9:02am Hi, I am fairly certain that you need to open the file f4 at the start and close it at the end. It looks like you are opening, writing one line and then closing your file. You are writing a phrase instead of a variable.
Permalink Reply by Upaka on October 13, 2011 at 9:13am Hi, thanks a lot for the suggestion. I tried it and still got the same word printing instead of the variable values.
Then I tried with fprintf (f4, STO); instead of fprintf (f4, "STO[0]"); which just gave me attached file.
Any reasons why I am not getting the variable values?
© 2012 Created by Robert Dickinson.
Powered by