(06-17-2022, 03:12 AM)bplus Wrote: Uhmmm, unless temp$ is shared (which would be kinda odd) your sub doesn't do anything to the state of the program outside the sub???
It certainly doesn't change Path$, you would need a final line Path$ = Temp$.
As per opening post: 2) Temp$ is DIMed at the start of my program as a SHARED string, so that variable should be available globally.
So let's say there's a point in that program that looks like this:
ClearPath Temp$
Now the SUB uses Path$ as the variable name, but they'll share the same offset. For all intents and purposes Path$ *IS* Temp$... When Temp$ = "" a few lines into the sub, Path$ will = "" as well. <-- This is the glitch we're seeing at work.
Now, with the issue diagnosed, I don't think finding it inside the program will be as simple as looking for a ClearPath Temp$. From my personal experience, I'd imagine the issue to come from something like:
SUB SetSlashes (Link$)
DO UNTIL INSTR(Link$, "/") = 0
MID$(Link$, INSTR(Link$, "/") = "\"
LOOP
ClearPath Link$
END SUB
At this point the program then does a SetSlashes Temp$, so Link$ = Temp$, which calls ClearPath which makes Path$ = Temp$, which leads to the roundabout issue of changing Temp$ changing Path$.
Best advice I can give to avoid this issue:
**Unless you need a return value via your SUB or FUNCTION parameter, pass to a temp variable and only use it to assign to a different value for the sub's exclusive use. **
Don't change your original variable, and you'll never have to worry about corruption of data that those changes might cause.