To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Jun 15th, 2005, 01:36 PM   #1
intraman
Addicted Member
 
Join Date: Sep 04
Location: Manchester
Posts: 206
intraman is an unknown quantity at this point (<10)
Reading from an awkward file...Thanks

Hello,

Any help is appreciated,

I wish to read from a data file called persist.data and then read the ENTIRE file into one variable. Is this possible?
The file contents will also be this only with different numbers.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
	<server>
		<stats>
			<total>
				559
			</total>
			<error>
				16
			</error>
			<html>
				197
			</html>
			<image>
				362
			</image>
			<notmodified>
				149
			</notmodified>
			<bytes>
				3043332
			</bytes>
			<uptime>
				5154
			</uptime>
			<since>
				Wed, 15 Jun 2005 14:05:31 GMT
			</since>
		</stats>
		<host>
			<id>
				1
			</id>
			<stats>
				<total>
					559
				</total>
				<error>
					16
				</error>
				<html>
					197
				</html>
				<image>
					362
				</image>
				<notmodified>
					149
				</notmodified>
				<bytes>
					3043332
				</bytes>
				<uptime>
					5154
				</uptime>
				<since>
					Wed, 15 Jun 2005 14:05:31 GMT
				</since>
			</stats>
		</host>
	</server>
</root>
Persist.data

Could all of this data fit into one variable?
If not, how would I got about split it into an array using the Input command.

Regards,

Jord
intraman is offline   Reply With Quote
Old Jun 15th, 2005, 02:02 PM   #2
MartinLiss
Administrator
 
MartinLiss's Avatar
 
Join Date: Sep 99
Location: Looking over your shoulder from San Jose, CA
Posts: 30,814
MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)
Re: Reading from an awkward file...Thanks

Do you know anything about the XML DOM?
__________________
Tips, Examples & Tutorials:
A valuable forum toolGenerate unique TreeView keysTreeView with "open" and "closed folder" iconsTime code using GetTickCountHow to trap the Tab keyScroll a formNumberBox ActiveX controlColor a ListView rowAn InputBox formHow to use SaveSetting and GetSettingA program registration schemeSpellcheck a TextboxResize controlsOpen Windows Explorer at Last Visited PathA Blackjack GameCount lines of codeV1.3Private Message ViewerCopy/Paste VB CodePaste VB Code Add-InInsert Procedure Names Add-InA calculator for the game of SpiderMy review of REALbasic 2008VB6 Debug TutorialPicture/Video ViewerVBF Photo Contest Winners

Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer.
2009-2010
If someone helped you today then please consider rating their post.
MartinLiss is offline   Reply With Quote
Old Jun 15th, 2005, 02:25 PM   #3
intraman
Addicted Member
 
Join Date: Sep 04
Location: Manchester
Posts: 206
intraman is an unknown quantity at this point (<10)
Re: Reading from an awkward file...Thanks

Quote:
Originally Posted by MartinLiss
Do you know anything about the XML DOM?
Afraid not, all I know is that it is a user defined set of tags.
intraman is offline   Reply With Quote
Old Jun 15th, 2005, 02:34 PM   #4
MartinLiss
Administrator
 
MartinLiss's Avatar
 
Join Date: Sep 99
Location: Looking over your shoulder from San Jose, CA
Posts: 30,814
MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)MartinLiss is a name known to all (1000+)
Re: Reading from an awkward file...Thanks

Then what you want to do is to download MSXML4 from Microsoft and install it. You may already have MSXML2 or 3 on your PC and they will work but 4 is better. Then using commands like selectNodes you will be able to get at the data you need. There are a lot of examples in this forum and the XML forum that should help you, and/or you can ask questions once you get started.
__________________
Tips, Examples & Tutorials:
A valuable forum toolGenerate unique TreeView keysTreeView with "open" and "closed folder" iconsTime code using GetTickCountHow to trap the Tab keyScroll a formNumberBox ActiveX controlColor a ListView rowAn InputBox formHow to use SaveSetting and GetSettingA program registration schemeSpellcheck a TextboxResize controlsOpen Windows Explorer at Last Visited PathA Blackjack GameCount lines of codeV1.3Private Message ViewerCopy/Paste VB CodePaste VB Code Add-InInsert Procedure Names Add-InA calculator for the game of SpiderMy review of REALbasic 2008VB6 Debug TutorialPicture/Video ViewerVBF Photo Contest Winners

Please go to the Thread Tools menu and click Mark Thread Resolved when you have your answer.
2009-2010
If someone helped you today then please consider rating their post.
MartinLiss is offline   Reply With Quote
Old Jun 15th, 2005, 02:51 PM   #5
moeur
Old Member
 
moeur's Avatar
 
Join Date: Nov 04
Location: In Hiding.... Weather: sizzzzlin'........ Code: Secret
Posts: 2,701
moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)moeur is a glorious beacon of light (400+)
Re: Reading from an awkward file...Thanks

to read it into one variable
VB Code:
  1. Dim FileLen As Integer
  2. Dim inVar As String
  3. Open "C:\Persist.data" For Binary As #1
  4. FileLen = LOF(1)
  5. inVar = String(FileLen, 0)
  6. Get #1, , inVar
  7. Close #1
  8. Debug.Print inVar
moeur is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:40 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.