#78658 - Globoeil - Sat Apr 08, 2006 6:27 pm
Hi all
Since one month I try to work on VGMDS (see it in PALIB projects section), I work with PALIB
and I can't make a stable part of my program.
So I really need your help.
I just want something SIMPLE:
Can you paste me the source of a simple-simple code who just write a file with a name given by user (using keyboard).
I've written the function to store char array from keyboard:
void readfromK(u8 maxsize,char* data){
u 8i=0;
PA_InitKeyboard(1);
PA_KeyboardIn (27, 20);
while(true) {
tmpc=PA_CheckKeyboard();
if(tmpc=='\n' || Pad.Held.A) break;
if(data[0]!='\n') PA_OutputText(0,0,1,"%s! ",data);
PA_EraseLastKey();
if(tmpc!=0 && tmpc!=PA_BACKSPACE && i<maxsize){ data[i]=tmpc;
if(tmpc!=PA_SHIFT) i++;
wait(5);}
if(tmpc!=0 && tmpc==PA_BACKSPACE && i>0) data[--i]='';
}
PA_KeyboardOut();
}
Now all that I want is the program with the main function, save function (readfromK function too, paste it).
Thankfull for your help.
What is simple for you will be really helpfull for me.
Since one month I try to work on VGMDS (see it in PALIB projects section), I work with PALIB
and I can't make a stable part of my program.
So I really need your help.
I just want something SIMPLE:
Can you paste me the source of a simple-simple code who just write a file with a name given by user (using keyboard).
I've written the function to store char array from keyboard:
void readfromK(u8 maxsize,char* data){
u 8i=0;
PA_InitKeyboard(1);
PA_KeyboardIn (27, 20);
while(true) {
tmpc=PA_CheckKeyboard();
if(tmpc=='\n' || Pad.Held.A) break;
if(data[0]!='\n') PA_OutputText(0,0,1,"%s! ",data);
PA_EraseLastKey();
if(tmpc!=0 && tmpc!=PA_BACKSPACE && i<maxsize){ data[i]=tmpc;
if(tmpc!=PA_SHIFT) i++;
wait(5);}
if(tmpc!=0 && tmpc==PA_BACKSPACE && i>0) data[--i]='';
}
PA_KeyboardOut();
}
Now all that I want is the program with the main function, save function (readfromK function too, paste it).
Thankfull for your help.
What is simple for you will be really helpfull for me.