I am using the following command, but as a result I am having some garrbage characters at the begining of the file. Can someone help on how this is happening?
It's to do with record length. If the variable being written is a variable-length string, Put writes a 2-byte descriptor containing the string length and then the variable. The record length specified by the Len clause in the Open statement must be at least 2 bytes greater than the actual length of the string.
You either need to define the variable length or (easier) open the file for Output and use Print #.
[tt]
Open "c:\fred23.txt" For output As #1
Print #1, "1|" & Trim("1984")
Close #1
[/tt]
Rather than using a constant as the file number, check out the FreeFile function
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.