string samples
In this thread i will post several different string examples over time, the first one is a simple console that will output "test"
the basics are, you allocate heap space for the string "TEST" it is converted to lowercase then output to the console
compiled with ziron 1.1.12.2
program WIN32CUI 'Sample';
//include simple memory manager - required for new, delete
#include 'smm32.zir';
//include console helpers for writing to the console
#include 'console.zir';
//declare a string pointer and allocate 5 bytes on the heap
char* mystr = new 5;
//copy the string TEST into 4 of the 5 allocated bytes, the last is a null char
strlcpy(mystr, 'TEST', 4);
//call the RTL function strLower to make the "TEST" to lowercase "test"
mystr = strLower(mystr);
//output the string, which will output "test"
WriteLn(mystr);
//deallocate the storage
delete mystr;
//sleep for 1 second to view the output before closing
Sleep(1000);
//exit the process
ExitProcess(0);