text files - use whole file, not first line

tonymaclennan
10-07-2004, 06:05 AM
hi guys, im using asp.net in vb, vb.net to create a website. However ive forgotton something really simple, the website creates a file called output.html, it contains a header, header.txt, and footer.txt,

i use
dim header as string
fileopen(1, header.txt, openmode.input)
input(1, header)
fileclose(1)

it only inputs the first lune, anybody got any ideas on how to input the whole file, then im combining it with footer, same method, to create an output file using 'openmode.output'

shaul_ahuva
10-07-2004, 02:27 PM
You could use the various classes in the System.IO namespace (like TextReader, TextWriter, etc.)

tonymaclennan
10-08-2004, 04:34 AM
You could use the various classes in the System.IO namespace (like TextReader, TextWriter, etc.)

thanks for the advice, but im afraid ive never come across this before, could you elaborate upon this please...

shaul_ahuva
10-08-2004, 07:39 AM
Oops, slight mistake. You should use StreamReader and StreamWriter (TextReader and TextWriter are abstract classes). You can pass a file path to both via constructors. StreamReader has a ReadToEnd method that reads the entire stream and returns it as one string, and StreamWriter has both Write and WriteLine methods.

For more information, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIO.asp.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum