UEZ Posted October 29, 2008 Share Posted October 29, 2008 (edited) Why is there a limitation when creating files to hard disk? E.g. Local $dummy, $i, $path For $i = 1 To 4096 ;4k filesize $dummy &= Chr(Random(33, 126, 1)) Next $path = "E:\Test\Test." For $i = 1 To 555 FileOpen($path & $i, 2 + 8) FileWrite($path & $i, $dummy) FileClose($path & $i) Next This script will create 4k files on drive E: / folder Test with name Test.1 - Test.509 whereas last file is empty, although the For / Next loop is from 1 to 555. Is this a limitation? Thanks. UEZ Edited November 8, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 29, 2008 Share Posted October 29, 2008 Why do you need to make that many files? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
UEZ Posted October 29, 2008 Author Share Posted October 29, 2008 Why do you need to make that many files?Why not? The reason is that my ext. 2.5" drive (80 GB) has a lot of bad sectors and I want to fill the whole disk with files to check them which are corrupt. Only "good" files will be deleted - the rest will allocate bad sectors.I wrote already a GUI but noticed that it creates only up to 509 files!UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Bowmore Posted October 29, 2008 Share Posted October 29, 2008 you are mixing file handles and filenames. This line in your code 'FileOpen($path & $i, 2 + 8)' is opening a opening a file that you never close so you run out of available file handels when you reach 509 From the the help file "Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Either use filehandles or filenames in your routines, not both." use either this method Local $dummy, $i, $path, $hfile For $i = 1 To 4096 ;4k filesize $dummy &= Chr(Random(33, 126, 1)) Next $path = "E:\Test_1\Test." For $i = 1 To 555 $hfile = FileOpen($path & $i, 2 + 8) FileWrite($hfile, $dummy) FileClose($hfile) NextoÝ÷ Øêí+&zØhu«¢+Ù1½°ÀÌØíÕµµä°ÀÌØí¤°ÀÌØíÁÑ ()½ÈÀÌØí¤ôÄQ¼ÐÀäØìѬ¥±Í¥é(ÀÌØíÕµµäµÀìô ¡È¡I¹½´ ÌÌ°ÄÈذĤ¤)9áÐ(ÀÌØíÁÑ ôÅÕ½ÐíèÀäÈíQÍÑ|ÈÀäÈíQÍиÅÕ½Ðì)¥É ÉÑ ÅÕ½ÐíèÀäÈíQÍÑ|ÈÅÕ½Ðì¤)½ÈÀÌØí¤ôÄQ¼ÔÔÔ(¥±]É¥Ñ ÀÌØíÁÑ µÀìÀÌØí¤°ÀÌØíÕµµä¤)9áÐ "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
UEZ Posted October 30, 2008 Author Share Posted October 30, 2008 you are mixing file handles and filenames. This line in your code 'FileOpen($path & $i, 2 + 8)' is opening a opening a file that you never close so you run out of available file handels when you reach 509 From the the help file "Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Either use filehandles or filenames in your routines, not both." use either this method Local $dummy, $i, $path, $hfile For $i = 1 To 4096 ;4k filesize $dummy &= Chr(Random(33, 126, 1)) Next $path = "E:\Test_1\Test." For $i = 1 To 555 $hfile = FileOpen($path & $i, 2 + 8) FileWrite($hfile, $dummy) FileClose($hfile) NextoÝ÷ Øêí+&zØhu«¢+Ù1½°ÀÌØíÕµµä°ÀÌØí¤°ÀÌØíÁÑ ()½ÈÀÌØí¤ôÄQ¼ÐÀäØìѬ¥±Í¥é(ÀÌØíÕµµäµÀìô ¡È¡I¹½´ ÌÌ°ÄÈذĤ¤)9áÐ(ÀÌØíÁÑ ôÅÕ½ÐíèÀäÈíQÍÑ|ÈÀäÈíQÍиÅÕ½Ðì)¥É ÉÑ ÅÕ½ÐíèÀäÈíQÍÑ|ÈÅÕ½Ðì¤)½ÈÀÌØí¤ôÄQ¼ÔÔÔ(¥±]É¥Ñ ÀÌØíÁÑ µÀìÀÌØí¤°ÀÌØíÕµµä¤)9áÐ Thanks for your help. I need to save path to a variable instead opening the handle which is limited to 509 handles. UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now