Historical andi49, Revision 3
New oe builts on http://euphoria.indonesianet.de/eu4zip.html
Strings and Chars in Euphoria (shortend and translated from German)
This an attempt to explain the difference from strings and chars to sequences and atoms.
Translated and very much shortend from my first attempt in German.
-- Euphoria has no 'String' and no 'Char' Types only 'sequence' and 'atom' integer a = 'A' -- 65 in ASCII notation not a "String" and not a 'char', see the single quotes as a Typecast integer b = 'B' -- 66 in ASCII notation not a "String" and not a 'char', see the single quotes as a Typecast -- what follows is the same as above just in different notations ... integer c = 65 -- Decimal integer d = 66 integer e= #41 -- Hex integer f= #42 -- ... -- So this is just an integer addition ?a+b ?c+d ?e+f -- in Pascal (ObjectPascal or fpc) this looks like -- var a : integer = integer('A'); // explicit Typecast -- var b : integer = integer('B'); // explicit Typecast -- writeln(a+b) -- ... -- and this is just an 'concat' for 'atoms' -- mean you built an 'seqeunce' out of 'atoms' ?a&b ?a&d ?e&f -- there are procedures in Euphoria that handles sequences as there where 'strings' -- but that is just for the programer to make his live easier.. puts(1,a&b) puts(1,'\n') -- same as puts(1,10) -- BTW in FreeBasic -- a=65 -- b=66 -- PRINT a&b -- gives the same result as above -- as the ampersand is a concat operator with implicit Typecasting to Strings.
Removing Resources from an .exe file
include std/dll.e include std/machine.e include std/console.e constant True=1 constant False=0 constant kernel = open_dll("kernel32.dll") atom beginupdateresource = define_c_func(kernel, "BeginUpdateResourceA", {C_POINTER, C_INT}, C_POINTER) atom endupdateresource = define_c_func(kernel, "EndUpdateResourceA", {C_POINTER, C_INT}, C_INT) function RemoveResource(sequence fname) atom handle,result atom pzstring=allocate_string(fname) handle=c_func(beginupdateresource,{pzstring,True}) if not handle then puts(1,"Error removing Resources from: "&fname&"\n") free (pzstring) abort(1) else result=c_func(endupdateresource,{handle,False}) end if if not result then puts(1,"Error removing Resources from: "&fname&"\n") free (pzstring) abort(1) end if free (pzstring) return result end function if RemoveResource("eub.exe") then puts(1,"Removed Resources from: "&"eub.exe"&"\n") end if if RemoveResource("eubw.exe") then puts(1,"Removed Resources from: "&"eubw.exe"&"\n") end if ?kernel ?beginupdateresource ?endupdateresource any_key()
Not Categorized, Please Help
|
- diff to current revision, view current revision history, backlinks
- Last modified Nov 21, 2014 by andi49