Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

file output using write

Posted on 2000-03-28
10
Medium Priority
?
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
10 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 2666061
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
ID: 2666188
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
ID: 2666462
The soultion is to use

ileno = freefile
                   open app.path & "\test.txt" for output as fileno
                   print #fileno, "testing"
                   close fileno
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:deighton
ID: 2666464
opps, already said
0
 
LVL 24

Expert Comment

by:SunBow
ID: 2675147
ditto.
My peers prefer the quotes for general import purposes, but I don't. So, RU
Done?
0
 

Accepted Solution

by:
monteh earned 15 total points
ID: 2685319
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 28

Expert Comment

by:Ark
ID: 2685599
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
ID: 2685612
Yes, sorry, I meant Open For Binary.
0
 
LVL 1

Author Comment

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

Expert Comment

by:SunBow
ID: 2708619
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 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