Cannot pass empty string to custom function?

Previous topic - Next topic

Cliff3D

Hi - I'm having trouble passing strings which may be empty (or may not be!) to my own function. I'm currently trying to walk up and down a file structure, but a simpler example might be:

Code (glbasic) Select
// --------------------------------- //
// Project: PassValuesToFunction
// Start: Monday, August 21, 2023
// IDE Version: 16.793

// SETCURRENTDIR("Media") // go to media files

LOCAL workpath$, str_Temp$ = ""
workpath$ = "C://"
SearchFolder(workpath$, str_Temp$, str_Temp$, 0)

// ------------------------------------------------------------- //
// ---  SEARCHFOLDER  ---
// ------------------------------------------------------------- //
FUNCTION SearchFolder: strPath$, strParentFolder$, strFileEntry$, numDepth%
// These values are defined LOCAL:
// strPath$,  strParentFolder$,  strFileEntry$,  numDepth%
DEBUG strFileEntry$
ENDFUNCTION // SEARCHFOLDER

When I run that code I never get an empty string in strParentFolder$ or strFileEntry$ = I get what look like random characters (see the attached screen capture)?

Help, anyone?

BTW the forum suggests that the current steam version is 16.026, while I have IDE Version 16.793? Are GLB and GLB's IDE on different version numbers?

Cheers,

Cliff

Qedo

I think it's just a problem in debugging mode.
if you add a line like:
debug LEN(strFileEntry$)+"\n" you will see the result is 0

Kitty Hello

Oh. I'll take a look at this one. Sorry.

Cliff3D

Quote from: Qedo on 2023-Aug-22I think it's just a problem in debugging mode.
if you add a line like:
debug LEN(strFileEntry$)+"\n" you will see the result is 0

Wow - many thanks for this. I believe in my project I have started passing the length of the string as an extra variable, so I can check that for 0 instead of checking the string for "".

Sorry for the delay in responding - I didn't get an email notification... but MANY thanks for your reply.

Cheers,

Cliff

Cliff3D

Quote from: Kitty Hello on 2023-Aug-23Oh. I'll take a look at this one. Sorry.

Nah, I'm sorry. Whenever I get back to GLBasic I seem to find "issues". But this is not unique to GLBasic - I just find problems everywhere I go!

I'm currently extremely anemic after a 7 unit blood transfusion earlier in the year - and i'm using the lack of iron in my blood as an excuse for wooly thinking :)

Cheers,

Cliff

Kitty Hello


Schranz0r

Quote from: Cliff3D on 2023-Aug-21BTW the forum suggests that the current steam version is 16.026, while I have IDE Version 16.793? Are GLB and GLB's IDE on different version numbers?

Fixed, thx for the hint.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard