I'm writing a program which creates multiple files on the fly which may be deleted, but I need to load all the filenames into a list when the program starts, and also one or more of them will be selected when the program is running. So the question is, how do I identify the files so I can load them when the program starts and later when they might be selected from the list? I can use #PB_Any to create the files but that won't help me to open them because I don't the numbers. Hope this makes sense.
So basically, for each filename, I want to generate a unique number from the filename to use as the filenumber.
identifying files
Re: identifying files
Why do you have to associate the file name with a number?
OpenFile() used with #PB_ANY gives you a PB file handle which you can use, you don't need to use a number.
I don't really understand what you want to do.
If you know where the file is you can just load it and save the file ID and the path in a custom structure or something
like that to clarify the association.
OpenFile() used with #PB_ANY gives you a PB file handle which you can use, you don't need to use a number.
I don't really understand what you want to do.
If you know where the file is you can just load it and save the file ID and the path in a custom structure or something
like that to clarify the association.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: identifying files
Maybe I'm misunderstanding something, but doesn't each file need to have a unique number in order to open it? I suppose my program works a bit like a database, only instead of Tables I'm using files. I want to be able to select any file (from a list) to be loaded at any time during the program, but these files can also be deleted.
Edit: Ok, I was confused.
Problem solved.
Edit: Ok, I was confused.

Problem solved.
Re: identifying files
Yes, that's what #PB_ANY is for. It gives you a unique "handle" every time you open a file.
The whole stuff about IDs is a PB thing. It's not really used anywhere else, at least I never saw it before and after my PB time.
WinAPI for example always gives you a handle, i.e. it always behaves similar like #PB_Any.
The whole stuff about IDs is a PB thing. It's not really used anywhere else, at least I never saw it before and after my PB time.
WinAPI for example always gives you a handle, i.e. it always behaves similar like #PB_Any.
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: identifying files
It's more like a BASIC thing. FreeBasic for example has it as well: http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgOpen
Be sure to read this: http://www.purebasic.com/documentation/ ... jects.html
Be sure to read this: http://www.purebasic.com/documentation/ ... jects.html