mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@9702 1feff8c3-07ed-0310-ac33-dd36852eb9cd
60 lines
1.1 KiB
C
60 lines
1.1 KiB
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <IPhreeqc.h>
|
|
|
|
int main(void)
|
|
{
|
|
int id, i, j;
|
|
|
|
id = CreateIPhreeqc();
|
|
if (id < 0) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (LoadDatabase(id, "phreeqc.dat") != 0) {
|
|
OutputErrorString(id);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (RunFile(id, "ex2") != 0) {
|
|
OutputErrorString(id);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
VAR v;
|
|
VarInit(&v);
|
|
|
|
printf("selected-output:\n");
|
|
for (i = 0; i < GetSelectedOutputRowCount(id); ++i) {
|
|
for (j = 0; j < GetSelectedOutputColumnCount(id); ++j) {
|
|
if (GetSelectedOutputValue(id, i, j, &v) == IPQ_OK) {
|
|
switch (v.type) {
|
|
case TT_LONG:
|
|
printf("%ld ", v.lVal);
|
|
break;
|
|
case TT_DOUBLE:
|
|
printf("%g ", v.dVal);
|
|
break;
|
|
case TT_STRING:
|
|
printf("%s ", v.sVal);
|
|
break;
|
|
case TT_EMPTY:
|
|
printf("<empty> ");
|
|
break;
|
|
case TT_ERROR:
|
|
printf("<error> ");
|
|
break;
|
|
}
|
|
}
|
|
VarClear(&v);
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
if (DestroyIPhreeqc(id)) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|