Register | Login
Forum Index > Samples > loadfs sample
Author Message
Pages: 1
Site Admin


(send private message)

Posts: 932
Topics: 54

OverHertz Studio
[15] loadfs sample - posted: 2011-05-10 23:06:11
loadfs is a recent addition to the Ziron compiler, it allows to load a file into a string, which can be used for numerous things, here i have quickly put together a tiny sample showing it in use...

in my case i have an image in the same directory as the source named leia.jpg you can change this of course... the exe when compiled will embed the image and when the exe is ran it will write test.jpg, this file is obviously the file you embedded, in my case leia.jpg

program WIN32GUI 'Sample';

//include file i/o macro inc file.
#include 'fileio.zir';

//create our file handle variable and create an empty file
DWord hFile = filecreate('.\\test.jpg');
//notice the loadfs which embeds the image at compile time
//write the embedded image at runtime, length is in bytes
DWord bytes = filewrite(hFile, loadfs('.\\leia.jpg'), 186347);
//close the file handle

//exit the application

this sample can be compiled with compiler version

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