Shadow Blade
Morrowland Presents Apron Tutorials
game - design - multimedia - web - programming - tutorials - There are currently viewers visiting Apron Tutorials.
   
 
TECHNICAL
GRAPHICAL
SOUND
GAME
WEB
ARTICLE
TOOL
PROJECT
 
 NEWS

  news

  history


 TECHNICAL TUTORIALS

  opengl

  direct3d

  c/c++

  visual basic

  java

  c#


 WEB TUTORIALS

  html

  dhtml

  asp

  php


 IMAGE EDITING

  photoshop

  draw sketch


 3D MODELING

  3d studio


 PROJECTS

  shadow blade

  game environment

  virtual 3d guide

  billy blue flame


 DEMOS

  win32 api


 ARTICLES

  general

  opengl


 COMMUNITY

  about us

  credit

  contact






MAKE/WRITE/DELETE TEXTFILES IN ASP
When you want to store some data, either how many viewers your page have registered, or you want to make a simple guestbook, you have to store the data. Textfiles is a rather easy way to do this. In this tutorial I will show how to make, write to and delete a textfile. I will not make a live example in this tutorial due to security. But you can cut and paste the code into your own code.



Make And Write To A File

You use the same methods for writing to a file, and making a new. If the file already exists, you will repleace the content with the new -> write new data to it.

Dim filename, fs, f
filename = "myfirstfile.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.CreateTextFile(filename,true)
f.write("Apron! This is my first file")
f.close
Set f=nothing
Set fs=nothing



The file above will have this output:

Apron! This is my first file.

If you want to replace part of the text file, I recommend you use xml files or a database to store your data. I have however made a wrapper class where you can manipulate the textfile. You can download the class and read more about it here.



Delete A File


Dim filename, fs, f
filename = "myfirstfile.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile(Server.MapPath(filename))
f.Delete
Set f=nothing
Set fs=nothing



PROJECT DESCRIPTION
Category Programming with ASP
Author Tommy Johannessen





Ronny André Reierstad
Morrowland All rights reserved Morrowland © 2002 Apron Tutorials

 LINKS

  morrowland home



 GAME DEVELOPEMENT

  nvidia

  gamedev

  polycount


 PROJECTS

  shadow blade

  game environment

  virtual 3d guide

  billy blue flame


 MATH AND PHYSICS

  mathworld

  physicsworld







PLEASE LINK TO


  All rights reserved Morrowland © 2007  
Ronny André Reierstad