Re: [OT] files/dir on windoze

new topic     » goto parent     » topic index » view thread      » older message » newer message

>From: Juergen Luethje <j.lue at gmx.de>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: [OT] files/dir on windoze
>Date: Thu, 08 Jul 2004 08:20:41 +0200
>
>Irv Mullins wrote:
> > Juergen Luethje wrote:
> >> It took about 18 minutes on my old PC. The last file is '17000.txt',
> >> containing the line "This is file #17000". I looks as if everything is
> >> correct on my system (Windows 98, FAT32).
> >> I think you are using Windows 95, and FAT16, right? But using the FAT16
> >> system shouldn't cause the problem, should it?
> > Perhaps you could try the test again, using long file names.
> > I'll bet it's either that (LFN) or FAT 16.
> > I haven't found any info on google about this, so it's not a very
> > common problem.
>
>Oops, I almost forgot about LFN. New program (as previously, using the
>exw.exe 2.4 interpreter BTW):
>Anything worked fine, up to file #08191 (inclusive). Then Euphoria said:
>"Can't create error message file: ex.err"
>
>Now it's your turn. smile
>

     I had about the same, but... 8191 text files, plus the program, the 
error file was still written, though. "file number invalid (-1)" was the 
error. I ran it in "D:\d". It took forever to try to delete the files, so i 
just deleted the directory, and recreated the program. There were no 
problems with the internet, or any other program, really.
     Here is the program in Windows API. All it does is replace the builtin 
functions. There's no error checking on write, which could be done, i 
suppose. The error still occurs at the same time, though. I get an error 
code of 82, which is ERROR_CANNOT_MAKE: "The directory or file cannot be 
created."

include dll.e
include machine.e

constant
kernel32 = open_dll("Kernel32.dll"),
GENERIC_WRITE = #40000000,
CREATE_ALWAYS = 2,
FILE_ATTRIBUTE_NORMAL = #00000080,
INVALID_HANDLE_VALUE = #FFFFFFFF,
xGetLastError = define_c_func(kernel32, "GetLastError", {}, C_ULONG),
xCreateFile = define_c_func(kernel32, "CreateFileA", {C_POINTER, C_LONG, 
C_LONG, C_POINTER, C_LONG, C_LONG, C_POINTER}, C_POINTER),
xWriteFile = define_c_func(kernel32, "WriteFile", {C_POINTER, C_POINTER, 
C_ULONG, C_POINTER, C_POINTER}, C_INT),
xCloseHandle = define_c_func(kernel32, "CloseHandle", {C_POINTER}, C_INT)

function open(sequence name, sequence form)
atom ret, lpName
lpName = allocate_string(name)
ret = c_func(xCreateFile, {lpName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 
FILE_ATTRIBUTE_NORMAL, NULL})
free(lpName)
if ret = INVALID_HANDLE_VALUE then
	printf(1, "Error: %d\n", {c_func(xGetLastError, {})})
	ret = getc(0)
	abort(0)
end if
	return ret
end function

procedure close(atom hFile)
atom c
c = c_func(xCloseHandle, {hFile})
end procedure

procedure puts(atom hFile, sequence text)
atom lpText, r, lpWritten
lpText = allocate_string(text)
lpWritten = allocate(4)
r = c_func(xWriteFile, {hFile, lpText, length(text), lpWritten, NULL})
free(lpWritten)
free(lpText)
end procedure

sequence number
atom t
atom fn

t = time()
for i = 1 to 17000 do
   ?i
   number = sprintf("%05d", {i})
   fn = open(number & " is the number of this file. Euphoria is cool."
           & " The weather is fine today.txt", "w")
   -- Each file name (including the extension '.txt') has 81
   -- characters. The directory, in which I ran the program was
   -- 'd:\d\'. So the full qualified name of each file consisted
   -- of 86 characters.
   puts(fn, "This is file #" & number)
   close(fn)
end for
t = time()-t
printf(1, "%d minutes", {t / 60})
if getc(0) then end if


>Regards,
>    Juergen
>

~[ WingZone ]~
http://wingzone.tripod.com/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu