davidgky
asked on
VB text file
How can I write a text file that has a length less than 256 using the VB print# statement?
Use the LOF to determine how many characters exist in a file..
RichardA:
As you are new here.. unless the answer is obvious and with no other solution.. it is customary to leave a comment, rather than an answer. The fact that you write "What code are you using that gives 256 char output?".. indicates that your answer is not conclusive. Nevertheless, you are correct in your question, as the problem identified by the questioner is quite unclear.. <smile>.
As you are new here.. unless the answer is obvious and with no other solution.. it is customary to leave a comment, rather than an answer. The fact that you write "What code are you using that gives 256 char output?".. indicates that your answer is not conclusive. Nevertheless, you are correct in your question, as the problem identified by the questioner is quite unclear.. <smile>.
I agree the answer is to obvious. What code are you using tht puts a 256 char string out??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you must use print, first you have to check (and maybe modify) the writable data's size (fill with spaces etc.).
like:
dim s as string
dim x as long
s = "String Size is 17"
x = Len (s)
etc...
like:
dim s as string
dim x as long
s = "String Size is 17"
x = Len (s)
etc...
Psy:
While your answer is very clear.. (as was RichardA's).. the question certainly is not. In cases like this, it is customary on EE to comment, until the questioner clarifies their intention. As such, please change your answer to a comment.. <smile>.
While your answer is very clear.. (as was RichardA's).. the question certainly is not. In cases like this, it is customary on EE to comment, until the questioner clarifies their intention. As such, please change your answer to a comment.. <smile>.
wsh2:
???
???
try the fileSystemObject for such operations.It is a neat way.
You can search vb help for that
1)you need windows scriping host on the system(is thr by dflt)
2)for now works with text file only,dont try bmp
You can search vb help for that
1)you need windows scriping host on the system(is thr by dflt)
2)for now works with text file only,dont try bmp
example
Dim nFile As Integer
nFile = FreeFile
Open App.Path & "\data.txt" For Output As #nFile
Print #nFile, "TEST"
Close #nFile
This should create an output file that ig 6 bytes long (it will have a carridge return/line feed characters entered)
What code are you using that gives 256 char output??