diff options
| author | Tomas Salfischberger <tomas@rockbox.org> | 2005-05-02 23:50:43 +0000 |
|---|---|---|
| committer | Tomas Salfischberger <tomas@rockbox.org> | 2005-05-02 23:50:43 +0000 |
| commit | 6875417fe232716128e5512bcaeb32a2593371b1 (patch) | |
| tree | bc00ff1d56b5eedc511cfd998a256623c40014c3 | |
| parent | 84364bc4ff17fa9a87f48c680e1d5d826b637a59 (diff) | |
| download | rockbox-6875417fe232716128e5512bcaeb32a2593371b1.zip rockbox-6875417fe232716128e5512bcaeb32a2593371b1.tar.gz rockbox-6875417fe232716128e5512bcaeb32a2593371b1.tar.bz2 rockbox-6875417fe232716128e5512bcaeb32a2593371b1.tar.xz | |
Changed Miika's open() and write() to fopen() and fwrite() the old way was causing some troubles with filepermissions. Please test on linux, and check if the file has normal permissions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6401 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | tools/rdf2binary.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/rdf2binary.c b/tools/rdf2binary.c index c1c7d1b..70ca495 100644 --- a/tools/rdf2binary.c +++ b/tools/rdf2binary.c @@ -46,15 +46,14 @@ long long_to_big_endian (void* value) int main() { - FILE *in; - int idx_out, desc_out; + FILE *in, *idx_out, *desc_out; struct word w; char buf[10000]; long cur_offset = 0; in = fopen("dict.preparsed", "r"); - idx_out = open("dict.index", O_WRONLY | O_CREAT); - desc_out = open("dict.desc", O_WRONLY | O_CREAT); + idx_out = fopen("dict.index", "wb"); + desc_out = fopen("dict.desc", "wb"); if (in == NULL || idx_out < 0 || desc_out < 0) { @@ -79,20 +78,20 @@ int main() /* We will null-terminate the words */ strncpy(w.word, word, WORDLEN - 1); w.offset = long_to_big_endian(&cur_offset); - write(idx_out, &w, sizeof(struct word)); + fwrite(&w, sizeof(struct word), 1, idx_out); while (1) { int len = strlen(desc); cur_offset += len; - write(desc_out, desc, len); + fwrite(desc, len, 1, desc_out); desc = strtok(NULL, "\t"); if (desc == NULL) break ; cur_offset++; - write(desc_out, "\n", 1); + fwrite("\n", 1, 1, desc_out); } } |