It is currently Wed Nov 25, 2020 3:31 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 12:52 pm 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5052
Location: Germany
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 1:50 pm 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1170
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 1:53 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1275
Location: right here
Code:
ShowMemoryViewer(@s, Len(s) * SizeOf(Character))


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 1:57 pm 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1084
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 2:56 pm 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1170
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 3:41 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2730
Location: Germany
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 / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 4:12 pm 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1170
Location: Portugal
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 6:22 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1275
Location: right here
But you probably didn't type the path but instead copied it from some other application that uses a weird format.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 6:27 pm 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5052
Location: Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files
PostPosted: Sat Nov 21, 2020 6:29 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3729
@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


Top
 Profile  
Reply with quote  
 Post subject: Re: Problem with files (Solved)
PostPosted: Sun Nov 22, 2020 5:44 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1170
Location: Portugal
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye