mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-28 10:51:14 +00:00
58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
/**********************************************
|
|
* STRINGS - Demonstrate string.h02 functions *
|
|
**********************************************/
|
|
|
|
#include <py65.h02>
|
|
#include <stddef.h02>
|
|
#include <stdlib.h02>
|
|
#include <stdio.h02>
|
|
#include <stdiox.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;
|
|
for (i = 0; i<=@srcrec.data; i++)
|
|
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);
|
|
memcpy(@srcrec, &srcrec);
|
|
|
|
prtdst();
|
|
|
|
goto exit;
|
|
|
|
//Print Destination Record
|
|
void prtdst() {
|
|
puts("REC.NAME="); putln(&dstrec.name);
|
|
puts("REC.INDEX="); putdec(dstrec.index); newlin();
|
|
puts("REC.DATA={");
|
|
for (i = 0; i<@dstrec.data; i++) {
|
|
if (i) putc(',');
|
|
putdec(dstrec.data[i]);
|
|
}
|
|
putln("}");
|
|
newlin();
|
|
} |