Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
abad5f27
Commit
abad5f27
authored
Aug 14, 2014
by
Thomas Jahns
🤸
Browse files
Add version of C table write for stdio streams.
parent
1cb3f25e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cdi.h
View file @
abad5f27
...
...
@@ -7,6 +7,7 @@
#ifndef CDI_H_
#define CDI_H_
#include
<stdio.h>
#include
<sys/types.h>
/*
#if defined(__cplusplus)
...
...
@@ -994,6 +995,7 @@ char *modelInqNamePtr(int modelID);
/* Table routines */
void
tableWriteC
(
const
char
*
filename
,
int
tableID
);
void
tableFWriteC
(
FILE
*
ptfp
,
int
tableID
);
void
tableWrite
(
const
char
*
filename
,
int
tableID
);
int
tableRead
(
const
char
*
tablefile
);
int
tableDef
(
int
modelID
,
int
tablenum
,
const
char
*
tablename
);
...
...
src/table.c
View file @
abad5f27
...
...
@@ -669,14 +669,23 @@ void tableWrite(const char *ptfile, int tableID)
void
tableWriteC
(
const
char
*
filename
,
int
tableID
)
{
FILE
*
ptfp
=
fopen
(
filename
,
"w"
);
if
(
!
ptfp
)
Error
(
"failed to open file
\"
%s
\"
!"
,
filename
);
if
(
CDI_Debug
)
Message
(
"write parameter table %d to %s"
,
tableID
,
filename
);
tableFWriteC
(
ptfp
,
tableID
);
fclose
(
ptfp
);
}
void
tableFWriteC
(
FILE
*
ptfp
,
int
tableID
)
{
char
chelp
[]
=
""
;
int
item
,
npars
;
size_t
maxname
=
0
,
maxlname
=
0
,
maxunits
=
0
;
char
tablename
[
256
];
if
(
CDI_Debug
)
Message
(
"write parameter table %d to %s"
,
tableID
,
filename
);
if
(
tableID
==
UNDEFID
)
{
...
...
@@ -686,8 +695,6 @@ void tableWriteC(const char *filename, int tableID)
partabCheckID
(
tableID
);
FILE
*
ptfp
=
fopen
(
filename
,
"w"
);
npars
=
parTable
[
tableID
].
npars
;
for
(
item
=
0
;
item
<
npars
;
item
++
)
...
...
@@ -751,8 +758,6 @@ void tableWriteC(const char *filename, int tableID)
}
fprintf
(
ptfp
,
"};
\n\n
"
);
fclose
(
ptfp
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment