>Can you help me to start with this? Maybe
just a sample or code snippet, basically, the UIR will display the
strings of text in the textbox being sent by the the comport. then this
text >or strings will be automatically be save to a file when i close
the uir or application, then start again with an incrementing saved
filename. Nay help will be greatly appreciated.
that is easy - just also write the strings you display in the text box to a file.
close the file upon closing uir/application.
as for automatic filename creation based on increasing numbers, you may
want to take the following code snippet as a starting point:
void IncFileName(char *Name, int inc)
{
char NewName[STRSIZ],NumStr[8];
int Num = 0,l = 0;
char c;
double expo=0;
StringLowerCase (Name);
strcpy(NewName,before(Name,".dat"));
l = strlen(NewName);
l--;
while (isdigit(c = NewName[l]))
{
Num = (int)(Num + (c - 48) * pow(10.0,expo));
expo++;
l--;
}
Fmt(NumStr,"%s<%d",Num);
strcpy(NewName,before(NewName,NumStr));
Num = Num + inc;
Fmt(NumStr,"%s<%d",Num);
strcat(NewName,NumStr);
strcpy(Name,NewName);
strcat(Name,".dat");
}
(which basically takes a filename of the form 'anynameXXXXXXXX.dat' as
an argument (X's represent numbers) and increments XXXXXXXX by inc -
note that 'before' is a self written string function which extracts the part of 1st argument string which is before the 2nd one)
--
Once the game is over, the king and the pawn go back into the same box.