Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read quotes in string when reading a text file?

Status
Not open for further replies.

Squonk33

Programmer
Oct 6, 2000
1
US
How do you read strings that contain quotes when reading information in from a text file coming from another application that is enclosing the string in quotes. For example, I want to read in a string of information that contains the measurement of 16' 4". The data is being presented in the file from the other apllication like this: "Max truss length is 16' 4"". The extra quote is throwing off all the subsequent data in the data file. Please HELP!!!!! [sig][/sig]
 
Open the file for Binary access:
[tt]
FF = Freefile
Open "MyTextFile.Txt" For Binary as #FF
GetBuffer$ = String$(LOF(FF), 32)
Get #FF,,GetBuffer$
Close #FF
[/tt]

If you need to handle individual lines separately you can do it after GetBuffer$ is in memory by using Instr to search for instances of VbCrlf or Chr$(13).

IMHO it is much faster and easier to read and parse a text file this way.

[sig]<p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>Don't sit down. It's time to dig another one.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top