forked from github/server
writing characters as numeric bytes is trickier.
This commit is contained in:
parent
9475e47606
commit
f07c80563a
1 changed files with 10 additions and 4 deletions
|
@ -2139,19 +2139,25 @@ a_writeshorts(const attrib * a, FILE * f)
|
||||||
int
|
int
|
||||||
a_readchars(attrib * a, FILE * f)
|
a_readchars(attrib * a, FILE * f)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
if (global.data_version<ATTRIBREAD_VERSION) {
|
if (global.data_version<ATTRIBREAD_VERSION) {
|
||||||
return a_readint(a, f);
|
return a_readint(a, f);
|
||||||
}
|
}
|
||||||
fscanf(f, "%c %c %c %c",
|
for (i=0;i!=4;++i) {
|
||||||
&a->data.ca[0], &a->data.ca[1], &a->data.ca[2], &a->data.ca[3]);
|
int c;
|
||||||
|
fscanf("%d", &c);
|
||||||
|
a->data.ca[i] = (char)c;
|
||||||
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
a_writechars(const attrib * a, FILE * f)
|
a_writechars(const attrib * a, FILE * f)
|
||||||
{
|
{
|
||||||
fprintf(f, "%c %c %c %c ",
|
for (i=0;i!=4;++i) {
|
||||||
a->data.ca[0], a->data.ca[1], a->data.ca[2], a->data.ca[3]);
|
int c = a->data.ca[i];
|
||||||
|
fprintf("%d ", &c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue