summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Salfischberger <tomas@rockbox.org>2005-05-02 23:50:43 +0000
committerTomas Salfischberger <tomas@rockbox.org>2005-05-02 23:50:43 +0000
commit6875417fe232716128e5512bcaeb32a2593371b1 (patch)
treebc00ff1d56b5eedc511cfd998a256623c40014c3
parent84364bc4ff17fa9a87f48c680e1d5d826b637a59 (diff)
downloadrockbox-6875417fe232716128e5512bcaeb32a2593371b1.tar.gz
rockbox-6875417fe232716128e5512bcaeb32a2593371b1.zip
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.c13
1 files 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);
}
}