X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2Flib%2Fini.c;h=b9e8f97ef99b11c624e5dd9d7a80b1c0f493e6bc;hp=e0bd1af8281dd26a295120750df32586ab2138c2;hb=be85325b006a230c8a59486c4bd28b03540b732e;hpb=9d2bbd34f22639745b23b7916ed3123c0dfed557 diff --git a/src/lib/ini.c b/src/lib/ini.c index e0bd1af..b9e8f97 100644 --- a/src/lib/ini.c +++ b/src/lib/ini.c @@ -124,7 +124,7 @@ void ReadString(char *SectionName,char *FieldName,char *FieldValue) { int loadINI(char *filename) { FILE *f; - int i, fpointer; + int i, fpointer = 0; char SectionName[SECTION_LEN], FieldName[FIELDNAME_LEN], FieldValue[FIELDVALUE_LEN], ch; f=fopen(filename,"rb"); @@ -150,10 +150,9 @@ int loadINI(char *filename) { removeSpace(SectionName); while(!feof(f)) { fread(&ch,sizeof(char),1,f); - if (ch == 0x0d) + if (ch == '\r' || ch == '\n') break; } - fread(&ch,sizeof(char),1,f); if (SectionName[0] == '\0') continue; while(!feof(f)) { @@ -195,7 +194,6 @@ int loadINI(char *filename) { } } removeSpace(FieldValue); - fread(&ch,sizeof(char),1,f); WriteString(SectionName,FieldName,FieldValue); } }