GLBasic forum

Main forum => Bug Reports => Topic started by: Cliff3D on 2023-Aug-21

Title: Cannot pass empty string to custom function?
Post by: Cliff3D on 2023-Aug-21
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
Title: Re: Cannot pass empty string to custom function?
Post by: Qedo on 2023-Aug-22
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
Title: Re: Cannot pass empty string to custom function?
Post by: Kitty Hello on 2023-Aug-23
Oh. I'll take a look at this one. Sorry.
Title: Re: Cannot pass empty string to custom function?
Post by: Cliff3D on 2023-Aug-25
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
Title: Re: Cannot pass empty string to custom function?
Post by: Cliff3D on 2023-Aug-25
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
Title: Re: Cannot pass empty string to custom function?
Post by: Kitty Hello on 2023-Aug-31
Can't reproduce it. :|
Title: Re: Cannot pass empty string to custom function?
Post by: Schranz0r on 2023-Sep-08
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.