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

avatar

(send private message)

Posts: 923
Topics: 54

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 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 533, May 5, 2016, 7:19 am.


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