Solved

file output using write

Posted on 2000-03-28
10
167 Views
Last Modified: 2010-05-02
Greetings,

i was wondering if it is possible to stop VB from surrounding everything written to a file using 'write' in quotes ("")

eg
----

fileno = freefile
open app.path & "\test.txt" for output as fileno
write #fileno, "testing"
close fileno

----
ends up with a file containing

"testing"

Any ideas?
0
Comment
Question by:wolfjjj
  • 2
  • 2
  • 2
  • +3
10 Comments
 
LVL 27

Expert Comment

by:Ark
Comment Utility
Hi
If you are using Write to save strings with commas etc, you NEED this quotes to reed this file correctly next time. If you haven't commas etc, you can use Print statement:
Print #fileno,"testing"
Cheers
0
 
LVL 3

Expert Comment

by:Gordonp
Comment Utility
yeh, what ark said.

Write, outputs your data to a file, in a format that allows them to be correctly read in again using input.

this means your strings will be surrounded by quotes, and your date variables would be surrounded by #.

if your Saving data to a file, and want to be able to retrieve it accurately.

use Binary file access, and the Put and Get functions.

Gordon


0
 
LVL 18

Expert Comment

by:deighton
Comment Utility
The soultion is to use

ileno = freefile
                   open app.path & "\test.txt" for output as fileno
                   print #fileno, "testing"
                   close fileno
0
 
LVL 18

Expert Comment

by:deighton
Comment Utility
opps, already said
0
 
LVL 24

Expert Comment

by:SunBow
Comment Utility
ditto.
My peers prefer the quotes for general import purposes, but I don't. So, RU
Done?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Accepted Solution

by:
monteh earned 15 total points
Comment Utility
You could also open the file for Binary.

Open "c:\test2.txt" For Output As fileno
' write an ANSI string
Put #fileno, , "testing"
0
 
LVL 27

Expert Comment

by:Ark
Comment Utility
Great :-)
>You could also open the file for Binary.
> Open "c:\test2.txt" For Output As fileno
' write an ANSI string
>Put #fileno, , "testing"

First,
you'll get an Error, because though you wrote <binary>, in your code you open for Output.
Second,
You can also open the file for ANY to write the string, but only "Write" statement put quotes. First you have to decide - how will you read this file in future (see Gordonp comment).
Cheers
0
 

Expert Comment

by:monteh
Comment Utility
Yes, sorry, I meant Open For Binary.
0
 
LVL 1

Author Comment

by:wolfjjj
Comment Utility
graded so low because you got it right in your description, but your code let u down
0
 
LVL 24

Expert Comment

by:SunBow
Comment Utility
I agree on comparative grade, but more 'cause I'd go with: follow the leads in Ark and Gordonp (even deighton) first.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now