FSO - Comma Delimited Text Files

Results 1 to 2 of 2

Thread: FSO - Comma Delimited Text Files

  1. #1
    Join Date
    Dec 1969

    Default FSO - Comma Delimited Text Files

    Hi! I have searched high and low, and now i have resorted to a message board!<BR><BR>I wish to display <BR>*a small message about 8 lines in total (like normal text with commas, apostraphies etc)<BR>*a phone number<BR>*a fax number <BR>*snail mail<BR><BR>on a web page.<BR><BR>I want it to be dynamic(read from a text fil), but do not want to use a database for this small amount of information.<BR><BR>doe ANYONE have a script to read from a text file, that is searches for a special character like a comma or ~~^(as a comma could be in the message)?<BR><BR>plus a script to write it to text file?<BR><BR><BR>Many thanks<BR>SF<BR><BR><BR><BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default I wouldn't do it like that...

    If you are only going to have one person in the file, then I&#039;d just put each item of info on it&#039;s own line in the file.<BR><BR>Put the text message *last*, since you won&#039;t know how many lines it will be.<BR><BR>So then it&#039;s easy:<BR><BR>&#060;%<BR>Set FSO = ...<BR>Set infile = FSO.OpenTextFile( Server.MapPath("data.txt") )<BR>phone = infile.readLine<BR>fax = infile.readLine<BR>streetAddr = infile.readLine<BR>cityStateZip = infile.readLine<BR>message = infile.readAll &#039; get all that is left<BR>infile.Close<BR>%&#062;<BR><BR>And then you can display the info from the variables.<BR><BR>***********<BR><BR>If you meant that there would be one set of info per person, with several people in the text file, then you have to get a *tiny* bit more complicate (though at this point I&#039;d probably say use a DB). <BR><BR>Writing the file is just as easy, using CreateTextFile instead of OpenTextFile and doing outfile.writeLine to put out each piece of info, in the same order.<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts