Problem with files (Solved)

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 6871
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Problem with files

Post by infratec »

collectordave wrote:With a simple comparison they are not the same.
If String1 = String2
debug "Same"
endif
You should compare the debug ouput 'optical' not via program :wink:

What is the difference?
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Problem with files

Post by collectordave »

When both are debugged they look exactly the same.

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Problem with files

Post by #NULL »

Code: Select all

ShowMemoryViewer(@s, Len(s) * SizeOf(Character))
BarryG
Addict
Addict
Posts: 3322
Joined: Thu Apr 18, 2019 8:17 am

Re: Problem with files

Post by BarryG »

When I copied your code (from your first post) and pasted it into the IDE, I get extra hidden copied characters before and after most slashes. This would be the cause of your problem, and are maybe not showing in the Debug Output because they are hidden. It would also explain why GetCurrentDirectory() is finding the file, because it won't have these extra hidden characters. So yeah, PureBasic is working as intended because the second example is definitely (and correctly) not finding the file specified.

Image
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Problem with files

Post by collectordave »

Hi

Just used the show memory and can see the hidden characters.

The question then is why is PureBasic adding these extra characters when creating a string?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Problem with files

Post by mk-soft »

Is a copy paste error with invisible characters.
Possibly the source of the string is not in the correct BOM format. If you write the String Manuel, there are no special characters in it.

The PB editor should always be set to UTF8.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Problem with files

Post by collectordave »

Hi

The editor is set to UTF8 and the string is simply assigned.

String = "My String" etc

Cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Problem with files

Post by #NULL »

But you probably didn't type the path but instead copied it from some other application that uses a weird format.
infratec
Always Here
Always Here
Posts: 6871
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Problem with files

Post by infratec »

If the length is different, but they look identicall, then there are hidden characters.

Use ShowMemoryViewer() to see the difference.
You need to set breakpoints, because you can only open one MemoryViewer.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Problem with files

Post by RASHAD »

@collectordave
Try to use SetCurrentDirectory(Directory$) to your path piece by piece to see where that function stopped working
Then post that part
Egypt my love
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Problem with files (Solved)

Post by collectordave »

Thanks to all.

Been working through all the suggestions and think I have found the problem.

When writing that particular application I was using a lot of long path names.

So I copied them all to TextEdit so I could pick each one as I needed it.

It seems that TextEdit added the hidden characters but of course nothing was apparent visually.

I have now retyped every path name manually and it works.

You live & learn.

Who was it that said you make less mistakes with experience and you gain experience by making mistakes?

So true.

Kind regards

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply