open and writing to a text file

Results 1 to 2 of 2

Thread: open and writing to a text file

  1. #1
    Join Date
    Dec 1969

    Default open and writing to a text file

    hi,<BR><BR>I am creating an administrative feature where the description of the product is stored in a text file.<BR>what I want to do is<BR><BR>1. using server.mappath locate the text file<BR>2. open the text file<BR>3. write to that & update<BR>4. save that info to same text file which was origionally stored.<BR><BR>Tjhe problem is <BR>I can open the text file asa n example bw10001.txt<BR>but I cannot open to see the description to write and update to that file.<BR><BR>the code I am using is as follows:<BR><BR>whichFN = Server.MapPath ("/") & "woodshopproduct ext\" & STK_FILE_FILENAME <BR> <BR>set FileOps = server.CreateObject("FileOperations.FileIO")<BR>&# 039Response.Write whichFN<BR>fileops.CreateFile cstr(whichfn),Request("stk_file_filename")<BR> <BR>set fileOps=nothing<BR> response.redirect("productlist.asp?Product="&m_STK _CODE)<BR><BR>can anybody help on this please???<BR>I looked into charles site for writing and reading into text files but it is of no use in this application.<BR><BR>thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: open and writing to a text file

    Try this:<BR>&#060;%PhysicalPath=Server.MapPath("name of file")<BR><BR>Set MyFileObject=Server.CreateObjec("Scripting.FileSys temObject")<BR>Set MyTextFile=MyFileObject.OpenTextFile(PhysicalPath, 1)<BR><BR>The 1 stands for reading a file, but you can use a 2 to write to a file, and 8 to append to a file. From what it sounds like you want to use an 8 to write to the end of the file. I hope this helps.

Posting Permissions

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