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.

DarkBASIC Professional Discussion / delete file not working!

Author
Message
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 22nd Oct 2003 14:06
im working on some file functions that i can reuse in many applications... the problem im comming across... it doesnt want to delete a file when im in the FUNCTION... but this is the purpose for the function... anyone know how i can go about doing this?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Oct 2003 14:28
With the following :



The file is deleted okay - what is your code ? Are you using P5.1b? Is the file in use when you want to delete the file ?


Avatar & Logo by Indi. Insert witty comment here...
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 22nd Oct 2003 14:34
little more info on what i am trying to do...

im making some INI functions, dont have C++, and i dont want the external files... to write info to the file, it does it one entry at a time... it copies line-for-line from file "A" and writes it into file "B"... this works extrodinary... however... after i am completed i need for file "A" to be gone so i ran rename "B" as the original "A" file... but it refuses to delete or rename...

i do have quite a bit of nested loops and GOTO commands... i dont know if any of that should effect it... but if anyone could help me out... THANKS

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Oct 2003 16:13
Got an INI file plug-in if thats any use


Avatar & Logo by Indi. Insert witty comment here...
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 00:17
so how does your dll work... the included .dba is a little wierd to understand... is there any kind of readme file or instructions?

and if i give someone else the source code for an application... i have to give them the INIFile.dll and the Memory.dll don't i?... that is why i wanted to do FUNCTIONs for them... so all they need is the source code... and no other external files.

and what kind of data can you store in your .ini files, currently mine only does strings... im trying to simplify it so its easier to use...

INI_ReadValue("File","Section","Key","Default Value")
INI_WriteValue("File","Section","Key","Value to Write")

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Oct 2003 00:25
I use this code ...
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 00:27
huh?
Quote: "I use this code ... "

you mean you "use HIS code"?

or did you forget to place the code in your post?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 23rd Oct 2003 00:30 Edited at: 23rd Oct 2003 00:31
Quote: "you mean you "use HIS code"?"

Click on the "source" button under Ian's post.

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 00:37 Edited at: 23rd Oct 2003 00:42
yeah... i knew that...

i see a bunch of functions... what is the usage for them?
have to "InitialiseKernel32DLL()" then read or write the values... then "ShutdownKernel32DLL()"?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 23rd Oct 2003 00:46 Edited at: 23rd Oct 2003 00:49
Well these functions call Windows API functions to write and read ini files. Call InitialiseKernel32DLL() before you use them and ShutdownKernel32DLL() when you're done.

Example:
InitialiseKernel32DLL()
WritePrivateProfileString("MySection", "MyKey", "Test", "MyIni.ini")
ShutdownKernel32DLL()

Write the following in the file MyIni.ini (and creates the file if it doesn't exist):

[MySection]
MyKey = Test

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 00:48
what is is the "GetPrivateProfileStringA" for in the code... i understand the rest of it... for the most part


==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 23rd Oct 2003 00:51
GetPrivateProfileStringA is the name of a WinAPI function (to retrieve a string from an ini file)

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 00:52 Edited at: 23rd Oct 2003 00:55
sweet... might have to edit some stuff to fit my needs... but a GREAT help!

the #constant at top... can i just change "KERNEL32DLLNUMBER" with 203...?

and is there a place where i can find out other API functions... see if i could use any?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 23rd Oct 2003 01:00
You can change KERNEL32DLLNUMBER with any number between 1 and 255 as long as you haven't used it with another Load DLL command (and haven't deleted it with Delete DLL).

As for the API guide:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_reference.asp

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Oct 2003 01:18
One thing that you need to take care with - in Win2K and WinXP, the profile files are mapped into the registry, unless you use a full pathname
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 01:24 Edited at: 23rd Oct 2003 01:27
well the problem im getting is this...
"#100008: Parameter for 'val' do not match 'String' at line 176."

that line is for reading strings... which i was testing the writing string funcion...

is there a typo in the code by chance?

and by full path... you mean all the "c:\whatever\program\file.ini"?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 23rd Oct 2003 01:40 Edited at: 23rd Oct 2003 02:09
i just ran a test... without the full pathname...

and it doesnt store it to the registry... i dont know whats going on... but whatever it is... its not working for me

...well i changed some stuff around... got it working good now... but i got a simple question... when it writes a new section it doesnt space anything... you know how to change that?

eg...


==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Oct 2003 12:38 Edited at: 23rd Oct 2003 12:38
Quote: "is there any kind of readme file or instructions"

Nope - although I am doing one for BASS. All you should need is the keywords200.ini file and the example code.

Quote: "i have to give them the INIFile.dll and the Memory.dll don't i?... "

If you want them to be able to compile it, then yes.

Quote: "and what kind of data can you store in your .ini files"

If I remember correctly, its strings, floats and integers.

Quote: "when it writes a new section it doesnt space anything... you know how to change that?"

Its dont done by the OS, so you have to do it yourself somehow.


Avatar & Logo by Indi. Insert witty comment here...
Genesis Rage
22
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 9th Nov 2003 06:36
im using the DLL thing for my ini file now... but i still have a question... its not letting me delete a file!

here is what i do...
delete (new file) if exists - (this delete works)
open to read (original)
open to write (new file)
write string (line-by-line from original, inserting when needed)
close file (both)
delete file (original) - (this delete doesnt work)
rename file (new file) to (original) - (doesnt work, original not deleted)

what i need this for is making small modifications in a file... only one line needs to be edited at any given time... but its not working because it wont delete the original file... (i have done tests, if i delete files before i open them, they delete, but after i have opened AND then closed them... i cant delete them!?!?!?

Login to post a reply

Server time is: 2026-07-26 15:30:52
Your offset time is: 2026-07-26 15:30:52