Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does _base64decode$ and _inflate$ work when used together?
#1
Probably I'm using this wrong which may be why it errors, but it just looks like to me this code should work, but it doesn't.  

This line works to get s$ when calling the function by themselves: 
s$ = _Base64Decode$(s$)
s$ = _Inflate$(s$)

But combining to do it this way doesn't put data to s$
s$ = _Base64Decode$(_Inflate$(s$))

Here's some code for example.  

- Dav

Code: (Select All)
'make short midi song to loop, channel 1
s$ = "eNpNirEJgDAURC8ICk7hBpY2IhExpEkhZAALC0GwcIEEXCAruImjuEn8HxXs7r17xs4TgBQCQlzGbgvRijgk2"
s$ = s$ + "VHgzBFqh1C5ffS1hK8kiweC5qH/RlHbMChqGxItQ0uj/57+fTqGTiKWuAHbIyjP"

s$ = _Base64Decode$(s$): s$ = _Inflate$(s$) '<<< when using this line, it works...
's$ = _Base64Decode$(_Inflate$(s$)) '<<< when using this line instead of above, it doesn't ..

song& = _SndOpen(s$, "memory")
_SndLoop song&
Sleep

Find my programs here in Dav's QB64 Corner
Reply
#2
(11-19-2025, 06:38 PM)Dav Wrote: Probably I'm using this wrong which may be why it errors, but it just looks like to me this code should work, but it doesn't.  

This line works to get s$ when calling the function by themselves: 
s$ = _Base64Decode$(s$)
s$ = _Inflate$(s$)

But combining to do it this way doesn't put data to s$
s$ = _Base64Decode$(_Inflate$(s$))

Here's some code for example.  

- Dav

Code: (Select All)
'make short midi song to loop, channel 1
s$ = "eNpNirEJgDAURC8ICk7hBpY2IhExpEkhZAALC0GwcIEEXCAruImjuEn8HxXs7r17xs4TgBQCQlzGbgvRijgk2"
s$ = s$ + "VHgzBFqh1C5ffS1hK8kiweC5qH/RlHbMChqGxItQ0uj/57+fTqGTiKWuAHbIyjP"

s$ = _Base64Decode$(s$): s$ = _Inflate$(s$) '<<< when using this line, it works...
's$ = _Base64Decode$(_Inflate$(s$)) '<<< when using this line instead of above, it doesn't ..

song& = _SndOpen(s$, "memory")
_SndLoop song&
Sleep
Think about this.   In the first case Base64Decode is first then Inflate.   In your Nested example it Inflates 1st

Try  s$ = _Inflate$(_Base64Decode$(s$))
Reply
#3
Hi. Note that the logic is different in each case. Where it works, you first unpack the Base64 string and then decompress it.

Where it doesn't work, you want the function that unpacks Base64 to unpack the string that is created when you unpack the compressed Base64 string with the Inlate$ function, which is of course wrong.


Reply
#4
LOL!  That's it.  So obvious I missed it. Thanks. 

Whoever took the idiot of the day award from me last year, hand it back over...

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#5
(11-19-2025, 06:49 PM)Dav Wrote: LOL!  That's it.  So obvious I missed it. Thanks. 

Whoever took the idiot of the day award from me last year, hand it back over...

- Dav

Dang!  They musta been really talented to hold onto an award "... of the day" for an entire year!!

PETE -- YOU GIVE THAT TO DAV RIGHT NOW AND QUIT HOARDING IT!!  I KNOW IT MUST BE YOU!!!!!!!

@Pete @Pete @Pete @Pete

Big Grin Big Grin Big Grin Big Grin Big Grin Big Grin Big Grin
Reply
#6
Sorry Steve, the last award I won was for best memory in a 70 year old. I'd prove it to you, but I forgot where I put it.

Pete Huh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CAN someone please get the graphics in this to work? Dragoncat 3 631 05-07-2025, 12:17 PM
Last Post: bplus
  Even robocopy doesn't work krovit 3 935 08-15-2024, 11:36 AM
Last Post: mdijkens
  GetWindowTextW - can you get it to work? TerryRitchie 12 2,949 06-11-2024, 11:17 AM
Last Post: SpriggsySpriggs
  Does _MapTriangle work in a user defined Window? bplus 12 2,211 02-16-2024, 01:40 AM
Last Post: bplus
Bug I want it to work so bad.... NasaCow 39 8,903 11-30-2022, 10:30 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)