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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
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

Code:
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
fileclose(hFile);

//exit the application
ExitProcess(0);


this sample can be compiled with compiler version 1.1.11.1

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:

Message:



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


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd