Using PureBasic 4.1
I get this error when I try to run my code and I use a number larger than 1000 for my #File parameter in OpenFile, etc.
If I make an EXE it will run fine
Why is this dangerous?
#File object number very high (over 1000), You sure of that?
Re: #File object number very high (over 1000), You sure of t
If you use a number of 1000, PB allocates 1001 Objectstructures for the Fileobjects
It is only a compilerwarning, you can ignore this, but it is better to use a small number
with Enumeration:
or use #PB_any.

It is only a compilerwarning, you can ignore this, but it is better to use a small number
with Enumeration:
Code: Select all
Enumeration ;files
#file1
#file2
EndEnumeration
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: #File object number very high (over 1000), You sure of t
Thanks for the info
my program will sometimes open / lock more than 1000 files at a time. Is there any danger in doing this ?
my program will sometimes open / lock more than 1000 files at a time. Is there any danger in doing this ?
Re: #File object number very high (over 1000), You sure of t
you open / lock 1000 file in one time ?
if you lock it step by step you can use the same number for all, but close files befor open the next!!
or you #PB_Any to open many files
if you lock it step by step you can use the same number for all, but close files befor open the next!!
or you #PB_Any to open many files
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: #File object number very high (over 1000), You sure of t
I want to keep the files locked so that they cannot be overwritten while the program is running. Even when I use #PB_Any when opening files it will sometimes reach a value greater than 1000 and the program will crash when trying to run it from PureBasic. It's getting annoying to have to create an EXE every time I want to test my program.
EDIT: Scratch it, I modified my program to use #PB_Any everywhere it tries to open / create a file and it's fine. I'm still curious as to why it's dangerous to use a number greater than 1000 or have more than 1000 files locked / open at a time. Seems like a crazy thing to cause a program to crash through the debugger.
EDIT: Scratch it, I modified my program to use #PB_Any everywhere it tries to open / create a file and it's fine. I'm still curious as to why it's dangerous to use a number greater than 1000 or have more than 1000 files locked / open at a time. Seems like a crazy thing to cause a program to crash through the debugger.
Re: #File object number very high (over 1000), You sure of t

Code: Select all
DisableDebugger
OpenFile(2000, "file.txt")
EnableDebugger
As ts-soft said it's unnecessary memory consumption.treebolt wrote:I'm still curious as to why it's dangerous to use a number greater than 1000 or have more than 1000 files locked / open at a time.
Also, as far as I know, the maximum number of handles for files, windows etc. are limited by the OS.
Last edited by Shield on Fri Mar 16, 2012 6:08 pm, edited 1 time in total.
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: #File object number very high (over 1000), You sure of t
Ahh, had no idea it was possible to disable the debugger through code. Pretty nifty.Shield wrote:![]()
Code: Select all
DisableDebugger OpenFile(2000, "file.txt") EnableDebugger
Still, anyone know why it's 'dangerous' ? There has to be a reason this limitation exsists
Re: #File object number very high (over 1000), You sure of t
See my edit...we should stop editing posts and just make double posts. 

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