From 6875417fe232716128e5512bcaeb32a2593371b1 Mon Sep 17 00:00:00 2001 From: Tomas Salfischberger Date: Mon, 2 May 2005 23:50:43 +0000 Subject: 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 --- tools/rdf2binary.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/rdf2binary.c b/tools/rdf2binary.c index c1c7d1b727..70ca495262 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); } } -- cgit v1.2.3