mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@9702 1feff8c3-07ed-0310-ac33-dd36852eb9cd
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <IPhreeqc.h>
|
|
|
|
const int SVALUE_LENGTH = 100;
|
|
|
|
int main(void)
|
|
{
|
|
int id, i, j, vtype;
|
|
double dvalue;
|
|
char svalue[SVALUE_LENGTH];
|
|
|
|
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;
|
|
}
|
|
|
|
printf("selected-output:\n");
|
|
for (i = 0; i < GetSelectedOutputRowCount(id); ++i) {
|
|
for (j = 0; j < GetSelectedOutputColumnCount(id); ++j) {
|
|
if (GetSelectedOutputValue2(id, i, j, &vtype, &dvalue, svalue, SVALUE_LENGTH) == IPQ_OK) {
|
|
switch (vtype) {
|
|
case TT_LONG:
|
|
printf("%ld ", (long)dvalue);
|
|
break;
|
|
case TT_DOUBLE:
|
|
printf("%g ", dvalue);
|
|
break;
|
|
case TT_STRING:
|
|
printf("%s ", svalue);
|
|
break;
|
|
case TT_EMPTY:
|
|
printf("<empty> ");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
if (DestroyIPhreeqc(id)) {
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|