Fix the black pixels at the top left in lcdLoadImage.

readFile was originally inteded as a string read function. Fix it to read binary, and add readTextFile for the other case.
This commit is contained in:
Stefan `Sec` Zehl 2011-08-21 19:10:08 +02:00
parent af598b3f3e
commit 0b51bdbd42
2 changed files with 14 additions and 5 deletions

View File

@ -56,9 +56,9 @@ void simpleNickname(void) {
/**************************************************************************/
void init_nick(void){
readFile("nick.cfg",GLOBAL(nickname),MAXNICK);
readFile("font.cfg",GLOBAL(nickfont),FILENAMELEN);
readFile("l0nick.cfg",GLOBAL(nickl0),FILENAMELEN);
readTextFile("nick.cfg",GLOBAL(nickname),MAXNICK);
readTextFile("font.cfg",GLOBAL(nickfont),FILENAMELEN);
readTextFile("l0nick.cfg",GLOBAL(nickl0),FILENAMELEN);
};
//# MENU nick editNick

View File

@ -39,17 +39,26 @@ int readFile(char * filename, char * data, int len){
return -1;
};
res = f_read(&file, data, len-1, &readbytes);
res = f_read(&file, data, len, &readbytes);
if(res){
return -1;
};
f_close(&file);
data[readbytes]=0;
return readbytes;
};
int readTextFile(char * filename, char * data, int len){
UINT readbytes;
readbytes=readFile(filename,data,len-1);
if(len>=0)
data[readbytes]=0;
return readbytes;
};
int writeFile(char * filename, char * data, int len){
FIL file;
UINT writebytes;