March 28, 2024, 01:49:03 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Odd Quirk with Fletchie's CTL.DLL

Started by LarryMc, July 15, 2007, 12:37:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

The few of you who use Fletchie's dll may find this useful.

I was using 2 routines in a subroutine in my program:

    GetPathFile(inc_file$,path,filename)
which you pass a full path to a file and it splits that into 'path' and 'filename'
and
    GetFileExt(filename,fname,ext)
which you pass a name to and it splits it into 'name' and 'ext'

He stated in his documentation that if you weren't interested in a given parameter being returned you could pass a NULL.

so I called the functions like this:
    GetPathFile(inc_file$,"",filename)
    GetFileExt(filename,fname,"")

And they returned the proper information I wanted.

In another subroutine (called after the sub above) I had a local string variable called c_struct.

Heres what I was seeing:

Quotec_struct = ""
    print "["+c_struct+"]"
   ' resulted in [inc]

    c_struct = "z"
    print "["+c_struct+"]"
   ' resulted in [z]

    c_struct = ""
    print "["+c_struct+"]"
   ' resulted in [inc] again

I changed c_struct from a string to a istring and back;
changed it from a local to global variable and back.

Still got the same result.  Fought it for hours.
Then I did a DUH!; where's the 'inc' coming from?

That's the extention of the files that I'm looking at so I went to the 2 functions of Fletchie's:
I changed the way I was calling them from:
    GetPathFile(inc_file$,"",filename)
    GetFileExt(filename,fname,"")
to
    GetPathFile(inc_file$,path,filename)
    GetFileExt(filename,fname,ext)

and wah-lah; my problem was solved.

Maybe I'm the only dummy who would ever do it the way I did but I'm posting this here just in case I have a dlone (dummy-clone) out there.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library