Register | Login
Forum Index > Samples > string samples
Author Message
Pages: 1
Site Admin


(send private message)

Posts: 932
Topics: 54

OverHertz Studio
[30] string samples - posted: 2011-05-12 15:08:35
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

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"

//deallocate the storage
delete mystr;

//sleep for 1 second to view the output before closing

//exit the process

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply

Quick reply:


Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.

Threads: 224 | Posts: 1847 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2023 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd