Page 1 of 2
Posted: Sat Jul 14, 2007 6:38 pm
by srod
kinglestat wrote:and
how do you do those data stuff from a file? Is there an automatic way to do this?
Just write a small utility which dumps a file to a PB program etc.
I just happen to have one lying around the floor!
Code: Select all
;This small utility creates a data section in raw binary format out of an external file.
;Useful for embedding small images directly within a source program etc,
;No error checking.
#linelength=40
inputfile$="back.ico"
outputfile$="data.pbi"
;Main program.
If CreateFile(1, outputfile$)
WriteStringN(1, ";"+inputfile$)
WriteStringN(1,"")
WriteStringN(1,"DataSection")
ReadFile(2, inputfile$)
line$=" Data.b "
While Eof(2) = 0
count+1
byte.c=ReadByte(2)
line$+Str(byte)
If count=#linelength
WriteStringN(1, line$)
line$=" Data.b "
count=0
Else
line$+", "
EndIf
Wend
If line$<> " Data.b "
WriteStringN(1, Left(line$, Len(line$)-2))
EndIf
CloseFile(2)
WriteStringN(1,"EndDataSection")
CloseFile(1)
Else
MessageRequester("Error!", "Problem creating output file!")
EndIf
Posted: Sat Jul 14, 2007 6:45 pm
by kinglestat
clever
thanks srod once again
I guess I have to upgrade from a couple of beers to a couple of champagne bottles next time I'm in England.
Posted: Sat Jul 14, 2007 7:00 pm
by srod
I only drink out of barrels these days!

Posted: Sat Jul 14, 2007 7:37 pm
by kinglestat
a barrel it is then

Posted: Sun Jul 15, 2007 2:53 am
by Rook Zimbabwe
sRod,
If that is a sample of whats just laying around on the floor... I would LOVE to see whats tossed haphazardly on your desk!
Great tool! Thanks!

Posted: Sun Jul 15, 2007 11:15 am
by kinglestat
moot point rook
Posted: Sun Jul 15, 2007 12:37 pm
by srod
Rook Zimbabwe wrote:sRod,
If that is a sample of whats just laying around on the floor... I would LOVE to see whats tossed haphazardly on your desk!
Great tool! Thanks!

Trust me, you really don't want to know what's lying on top of and underneath my desk! I really should get a cleaner I guess!

Posted: Sun Jul 15, 2007 1:16 pm
by Baldrick
srod wrote:
Trust me, you really don't want to know what's lying on top of and underneath my desk! I really should get a cleaner I guess!

Good to know I am not the only 1 who suffers from this affliction
( Besides, ..... a clean desk is a sign of a sick mind so they tell me!! )
Posted: Sun Jul 15, 2007 2:14 pm
by kinglestat
well, I have 3 offices now at home......I try to choose the least messy...and avoid the ones where I see new life forms start to emerge...lets just say it my contibution to science!
Posted: Sun Jul 15, 2007 2:26 pm
by srod
My b*stard coffee mug has welded itself to the top of my desk and refuses to budge. I have to drink coffee from a straw now! Damn thing has an IQ in excess of my own now. Indeed, it's helping me debug some code here!
As for the bugs? Well they've moved into my laundry basket now and are busy creating a eutopian civilisation. The swines refuse to give me my socks back, -they were good for at least another 6 weeks or so!
Now who wins the slob of the year competition?

Posted: Sun Jul 15, 2007 3:07 pm
by kinglestat
you always win!