Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / Can make file() issue

Author
Message
Valdez515
14
Years of Service
User Offline
Joined: 4th Jul 2009
Location: United Kingdom
Posted: 30th Nov 2011 21:46 Edited at: 30th Nov 2011 21:58
Place the following code in a project within the Windows folder:



"Successful" is printed but test.dat is not created. Is this a bug or have I missed something fundamental?

Specifications:

- Windows 7 64 bit
- Intel core i5 2.6GHz and 4GB of RAM
- AMD Radeon 5850, latest drivers
- Latest version of Dark Basic Professional with Indigo

[Insert witty remark here]
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2011 22:10
Indigo? Pokemon?

Perhaps your fundamental issue is that you are in a restricted folder and maybe did not run as administrator privileges ... Silly word darn it...

But perhaps a clue... Why are you even trying to work in that folder anyway?

Perhaps shedding some light on your intentions may bring about a more direct response...

Why not create the file elsewhere and try moving or copying it to that directory... You could also try turning UAC off.

Valdez515
14
Years of Service
User Offline
Joined: 4th Jul 2009
Location: United Kingdom
Posted: 30th Nov 2011 22:19
By Indigo I meant the custom IDE. My point is, it acts as if it wrote the files (by printing 'Successful', after confirming it could) but there is no 'test.dat' in existence. It should have printed 'Unsuccessful'. The only issue is, if I were to distribute the program and someone put it in a restricted directory, the program could continue unaware some files it hadn't actually created, which obviously could cause issues.

[Insert witty remark here]
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2011 22:45 Edited at: 30th Nov 2011 22:55
Oh I missed it the first ime around... Remove the first wait key in your code after print auccessful...

You shouldnt be doing anything in the windows directory its highly controlled

EDIT

in fact remove all the wait keys... Your script is all wrong...

You should do this I cant verify the code atm I am on mobile...



You might want to look into file and nested if statements commands...

Hope this helped...

Oh I think you can remobe the =1 in the if file exists part...

Valdez515
14
Years of Service
User Offline
Joined: 4th Jul 2009
Location: United Kingdom
Posted: 30th Nov 2011 23:20 Edited at: 30th Nov 2011 23:20
Quote: "You shouldnt be doing anything in the windows directory its highly controlled"


It was merely an example. Hopefully, in reality, the user won't place it there.

My concern is you shouldn't have to verify whether the file exists or not. Dark Basic Professional should detect it can't make a file in the directory and return a value of zero, proceeding to 'Else' and informing the user the attempt was unsuccessful. It does not appear to be working. Of course, the solution you provided is sufficient but the command fundamentally does not appear to be working and should surely be fixed.

Thank you anyway.

[Insert witty remark here]
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Nov 2011 23:32 Edited at: 1st Dec 2011 12:24
Actually... If you set the commands up correctly... Without the wait keys insite the if statements... You might have been ok... And you HAVE to check if a file exists as you never know... Your anti virus might have picked it up immediately after you created it and you would never know... Eithereay its not broken... The code I gave you works... No need to say something that is not true.

Eitherway did you try removing the wait key from your code?

why not first check to see in one function if you can make files then proceeding it create the file and check that it exists...

Usually it is common to perform a check for if the file exists then if it does... Delete it and then create the file tgen check that the file was crwated...

Its just plain common sense and good practice... Just as you would lock your door and check that it is indeed locked...

EDIT

pock pick pock pick
My new language... Its full of unseen typos...

Valdez515
14
Years of Service
User Offline
Joined: 4th Jul 2009
Location: United Kingdom
Posted: 1st Dec 2011 09:25 Edited at: 1st Dec 2011 09:25
Odd, removing the wait keys does seem to create the file. Though two were unnecessary, I don't understand why they would cause an issue.

Quote: "Your anti virus might have pocked it up immediately after you created it and you would never know"


It would have alerted me, surely?

My initial point was that it seemed the command wasn't working. It wasn't hard to get around it though but there was still a bug.

Anyway, this seems to have been resolved, though I am still mystified as to how.

[Insert witty remark here]
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 1st Dec 2011 12:28
If it put it in quarantine then it usually wont inform you... Thanks for pointing pock out lol...
But yeah breaking code from my view ... Wait key is a process break... Or pause...
Tenda to put on hold all operations...

Glad I could help resolve this

But really get into the nack of verifying existence of objects and other things as its solid coding and a good foundation for better diagnostics and other stuff...

A thank you would be nice

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 1st Dec 2011 13:33
Strange.

The compiled exe using the original code (with waits ) works fine wherever I put it. [Tested on both my XP and Vista machines.]

Why on earth would wait key have any effect on this?
Valdez515
14
Years of Service
User Offline
Joined: 4th Jul 2009
Location: United Kingdom
Posted: 1st Dec 2011 18:17
Thank you MrValentine

I think I can shed some light on the issue. I presumed I was using the latest editor as when I clicked on the 'Check for updates' option in the menu it informed me this. Nonetheless, I downloaded the latest version manually and installed it with noticeable differences and the code now works. Wait key definitely did have an effect when I tried it earlier, though. Odd.

[Insert witty remark here]
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 1st Dec 2011 18:20
glad to help

Login to post a reply

Server time is: 2024-04-24 10:38:38
Your offset time is: 2024-04-24 10:38:38