ilya31
30th April 2005 00:25 UTC
max amount of characters that can be written to a file
What is the maximum amount of characters that I can write to the Temp file that that was created for me using GetTempFileName command? Here is the code that I wrote to write HTML code to the temp file. When I run my program the HTML page is created, but at some point the text that I write to the file is getting cut off and does not show up in the wcab_forms.html. So I am guessing I hit the limit to the amount of characters that I can write to the file. How can I increase the limit? Thank you.
GetTempFileName $R1 "$INSTDIR\Version 1.2"
ClearErrors
FileOpen $8 $R1 "w"
FileWrite $8 "some HTML code"
FileClose $8
Rename $R1 "$INSTDIR\Version 1.2\wcab_forms.html"
Yathosho
30th April 2005 00:33 UTC
the special builds might at least increase this limit
ilya31
30th April 2005 01:14 UTC
Thanks, it is still kind of short. I guess I would need to build the web page outside of the installer.
Comperio
30th April 2005 01:48 UTC
The GetTempFileName Function should only return the name of a file, but should have no bearing on what gets created within the file itself. (In fact, I think you'll find that it's the FileOpen command that actually creates the file, not the GetTempFileName function.)
I'd say your problem is likely that you are trying to write too many charcaters at once. You may need to write to the file with several FileWrite commands strung together.
(I'm not sure what the actual limit is, but since FileRead can only deal with 1024 characters, I'd guess that FileWrite is probably the same.)
ilya31
1st May 2005 20:24 UTC
Thanks, I will try your suggestion. I will use several FileWrite commands instead of one. For the FileOpen command I would need to use append (FileOpen $8 $R1 "a"), right? So the contents of my 1st FileWrite command would not be erased.
Anders
2nd May 2005 00:15 UTC
You dont need to open and close the file between writes.
Ex:
FileOpen x abcd
FileWrite x yy
FileWrite x zz
FileClose x
RobGrant
3rd May 2005 09:58 UTC
Incidentally if you want to use append, you also have to stick the filepointer at the end of the file:
FileOpen $0 "filename" a
FileSeek $0 "0" end
FileWrite $0 "stuff"
FileClose $0