Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Dabzy

2025-10-17, 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

2025-10-17, 17:22:26
When I saw it. It was in the very early hours when normal people are fast asleep. Lasted for around half an hour before back to normal.

Dabzy

2025-10-17, 15:02:27
First time I seen it, having me cuppa at work and had a browse... Saw it and I was like "WTF is that!?!", so got on the blower!

Baggey

2025-10-17, 11:22:52
Oh goody. Was getting withdraw symptons!

Jackdaw

2025-10-17, 10:38:44
I saw that the other week, and forgot to query it. Redirects to sedo.parking.

Dabzy

2025-10-17, 10:33:24
Seems we lost the site for a bit there, sorted, basically htaccess went a bit screwy and it was diverting to one of them stupid default search pages... Been on to ionos the host provider and they fixered it! \o/ Had meself a bit of a sweat on there!  ;D

Jackdaw

2025-10-16, 20:00:40
Going to have to try bourbon and beans. That should be an explosive combination.

Baggey

2025-10-16, 13:15:42
I sometimes mix a chicken vindaloo and a Tika Masala together. Awesome  :P

Dabzy

2025-10-16, 05:49:34
And doing the act was the realisation I went for an indian when out... 20mins I was in the thunderbox waiting for me back chaff to cool down!

Dabzy

2025-10-16, 05:48:11
When I was on my "Year On The Blur", aka drinking after getting divorced, I was minging one night, couldnt remember getting home. Anyway, next day, went to work, and needed a poo...

Members
Stats
  • Total Posts: 1,816
  • Total Topics: 226
  • Online today: 29
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 0
  • Guests: 5
  • Total: 5
Welcome to SyntaxBoom. Please login or sign up.

Recent

NextFile oddity...

Started by Chalky, Jun 17, 2025, 11:42 PM

Previous topic - Next topic

Chalky

I have been using NextFile quite happily for years to read the contents of directories and not had any problems [that I have been aware of].

However, I have noticed some strange results this week, when my trusty "get-directory-contents" routine started finding non-existent files.

The code I use originated in the BlitzMax help files and is nothing clever. Most of the time the resulting directory contents match that of File Explorer or Xplorer2 - but every now and then NextFile will "find" a file which doesn't exist [i.e. the file is not in Explorer and FileType() returns 0, as does FileSize()].

Does anyone have any idea why this might be happening?

Midimaster

You write FileSize() returns 0?

A not existing file would return -1 if you scan it with FileSize().

What is the filename that NextFile() reports?

Chalky

#2
Sorry - my bad. FileSize() returns -1 [except every now and then it returns what looks like a valid value] and FileTime() always returns 0. There are several files which appear - not just one. It can be in any directory. It's as if it's detecting deleted files (that's just a guess, as some of them are in directories I wouldn't normally explore, and only did so while testing my program).

I can work round the problem by checking FileTime() but I'm totally baffled as to why it's happening in the first place...

Midimaster

I cannot see the same problem on my computer. I tested the example code before and after I deleted some files:

'File System Example
SuperStrict
Local dir:Byte Ptr = ReadDir("C:/Users/Mydir/Documents" )
If Not dir Then
    RuntimeError "Cannot open folder"
End If
Local file:String
Repeat 
    file = NextFile(Dir) ' Get the filenames in folder
    Print file    
Until file = ""
CloseDir(dir)

But both test runs showed exactly what I expected. Once with the files, then without the deleted files.

I would suggest not to use your app, but test the behaviour with the example code and see, whether you get the same wrong results. Additionally
I would suggest to expand this example with the following function to get more information about the "ghost files":

FileType()
RealPath()
FileExists()
FileTime()
FileSize()
FileMode()

Then I would suggest to copy one of this folders (with windows explorer) to an USB stick and see, what now the example reports about the content of the USB-Stick.

I guess, that not the Blitzax code is the problem, but the harddisk...

Baggey

May not be related i couldn't save files to the C: drive directly. A windows security thing?

I could only save to a named folder already created!

If that helps great! If not ignore it! :D
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad

Chalky

Thanks Baggey!

There's nothing wrong with my code - I've been using the exact same functions (via "Include") for years without issues.

However - you're idea of copying to another drive was genius - as after doing so my program scanned the 'new' folder and did not find anything which did not exist.  ;D

You are therefore correct - it is the hard drive (SSD) which is causing the problem rather than BlitzMax. At least this means I can carry on programming in the knowledge that it is working correctly despite what I'm seeing on screen (the problem only occurs with folders on the "C:/" drive).

Sadly I have no idea what I can do to correct the underlying problem...  :(

Jackdaw

#6
Try running the usual standard M$ Windows drive checks. And if the SSD has software from the manufactures, then run the manufacture's test tools.
If you've dug yourself into a hole. Just keep digging. You're bound to come out the other side eventually.

Chalky

Well - I have run every check I can think of on the SSD (including those supplied by Crucial, as suggested) without any errors.

However (and this is the REALLY weird part):

1) If I load the source into MaxIDE or BLide and run it (with debug on or off - it doesn't make any difference) NextFile finds files which do not exist.
2) If I double click the .exe created by MaxIDE or Blide in step 1 from File Explorer, no non-existent files are found.

This makes no sense to me. The same .exe file is running in steps 1 and 2. Why then, if being launched from within an IDE, do things not work as expected?

PS: No reply expected - though it would be nice to understand what's going on...

Baggey

#8
Do You switch between Blide and Normal BlitzmaxNG editor dont like each other?

If you use BLide it currupts the files and BlitzmaxNG then has problems with it.

Try cutting and pasting your code in to note pad or something.

Delete every file you see related to the old stuff!

Now Create a new blank file and cut and paste your text back in and resave!

This happend to me with some projects i was working on and solved the problem. I can still save stuff to the C drive as long as it goes in a Folder first.  ::)

Whilst Blide is a nice looking ide BlitzmaxNG IDE out of the box, is all i work with since that happened to me. I also remember stuff getting altered by the VisualStudio Blitz app as well.

Kind Regards Baggey
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad