This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Calculator Programming subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. General Coding and Design => Calculator Programming
Author Message
Newbie


Bandwidth Hog


Joined: 23 Jan 2004
Posts: 2247

Posted: 29 Jul 2007 05:06:30 pm    Post subject:

Well the topic title pretty much explains it all. Is there any possible way to write parenthesis to a text file in visual basic? I tried looking up it's character decimal but it doesn't have one. Anyone have an idea on how to do this?
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 29 Jul 2007 05:46:58 pm    Post subject:

Open "file.txt" For Output As #1
Print #1, "()"
Close #1
Back to top
Newbie


Bandwidth Hog


Joined: 23 Jan 2004
Posts: 2247

Posted: 29 Jul 2007 08:16:28 pm    Post subject:

Whoops I don't know what I was thinking. I actually needed quotation marks, not parenthesis. Sorry. That's whats more difficult.
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 29 Jul 2007 08:43:36 pm    Post subject:

You do two quotes to represent one, so to put a single quote in a file:


Code:
Open "file.txt" For Output As #1
Print #1, """"
Close #1


To put "This is in quotes" in a file:


Code:
Open "file.txt" For Output As #1
Print #1, """This is in quotes"""
Close #1
Back to top
Newbie


Bandwidth Hog


Joined: 23 Jan 2004
Posts: 2247

Posted: 29 Jul 2007 09:03:31 pm    Post subject:

Thanks. I guess it just required more quotation marks than expected. I was only putting two pair and not three.
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 29 Jul 2007 09:38:28 pm    Post subject:

Well, keep in mind that if two quotation marks are needed to display one, then at the beginning or end of a literal string you need three, one for the beginning/end of the string, and two for the quotation mark in the string.

Personally, I find this method visually unpleasant. I think you can also use something like chr(34) to get the quotation mark (I'm not sure if chr is the function, but I'm pretty sure 34 is the ascii value...too lazy to check).

I can't think of many reasons to want to write quotation marks to text files...is this perhaps going to be used in a new TI-BASIC editor for the computer? Smile
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 30 Jul 2007 07:34:23 am    Post subject:

There is no predefined constant for it in http://msdn2.microsoft.com/en-us/library/f63200h0.aspx so you need Chr$(34)

"Visual Basic is visually " & Chr$(34) & "unpleasant" & Chr$(34) & "."

Output text should come from a template or other resource. It should not be hardcoded. Then you don't have this problem.


Last edited by Guest on 30 Jul 2007 07:36:30 am; edited 1 time in total
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 31 Jul 2007 11:56:33 am    Post subject:

I assume this is VB6. If it isn't, then forget everything you ever knew about VB6's file manipulation and take a look at the TextWriter class (or the File class with, for example, its static File.WriteAllText method).

(If you are using VB6, I strongly recommend moving to later versions, which make significant improvements to the language). Wink
Back to top
Newbie


Bandwidth Hog


Joined: 23 Jan 2004
Posts: 2247

Posted: 31 Jul 2007 03:45:47 pm    Post subject:

Actually I'm using VB.Net version 9.
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 01 Aug 2007 06:25:09 am    Post subject:

OK, then I'd take a look at System.IO and the marvels within. Wink
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement