2018-03-08 19:35:00 +00:00
|
|
|
/**********************************************
|
|
|
|
* STRINGS - Demonstrate string.h02 functions *
|
|
|
|
**********************************************/
|
|
|
|
|
|
|
|
#include <py65.h02>
|
|
|
|
#include <stdio.h02>
|
|
|
|
#include <stdiox.h02>
|
|
|
|
#include <stdlib.h02>
|
|
|
|
#include <memory.h02>
|
|
|
|
#include <string.h02>
|
|
|
|
|
|
|
|
char d, i;
|
|
|
|
|
|
|
|
//Define Structure
|
|
|
|
struct record {
|
|
|
|
char name[8];
|
|
|
|
char index;
|
|
|
|
data[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
//Declare Structure Variable
|
|
|
|
struct record srcrec;
|
|
|
|
struct record dstrec;
|
|
|
|
|
|
|
|
main:
|
|
|
|
|
|
|
|
//Set Structure Members
|
|
|
|
strdst(&srcrec.name); strcpy("RECNAME");
|
|
|
|
srcrec.index = 1;
|
2018-03-09 01:07:31 +00:00
|
|
|
for (i = 0; i<=@srcrec.data; i++)
|
2018-03-08 19:35:00 +00:00
|
|
|
srcrec.data[i] = i;
|
|
|
|
|
|
|
|
//Clear Destination Record
|
|
|
|
for (i=0; i<140; i++)
|
|
|
|
dstrec[i] = 0;
|
|
|
|
prtdst();
|
|
|
|
|
|
|
|
//Copy Source Record into Destination Record
|
|
|
|
memdst(&dstrec);
|
2018-03-09 01:07:31 +00:00
|
|
|
memcpy(@srcrec, &srcrec);
|
2018-03-08 19:35:00 +00:00
|
|
|
|
|
|
|
prtdst();
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
//Print Destination Record
|
|
|
|
void prtdst() {
|
|
|
|
puts("REC.NAME="); putln(&dstrec.name);
|
|
|
|
puts("REC.INDEX="); putdec(dstrec.index); newlin();
|
|
|
|
puts("REC.DATA={");
|
2018-03-09 01:07:31 +00:00
|
|
|
for (i = 0; i<@dstrec.data; i++) {
|
2018-03-08 19:35:00 +00:00
|
|
|
if (i) putc(',');
|
|
|
|
putdec(dstrec.data[i]);
|
|
|
|
}
|
|
|
|
putln("}");
|
|
|
|
newlin();
|
|
|
|
}
|