File handling How to open files, read/write to them etc

Misc file handling routines

Open/create/close file

  • Opening an existing file - ASPCode.net Date added:(1/22/2000 4:17:18 PM) -
  • Opening an textfile 2 - ASPCode.net Date added:(1/22/2000 4:20:14 PM) ( create a new empty file if it doesn't exists )
  • Closing a file - ASPCode.net Date added:(1/22/2000 4:21:17 PM) When you are done using a file, be sure to explicitly close it ASAP

Reading from/writing to a file

  • Read from a file - ASPCode.net Date added:(1/22/2000 4:22:47 PM) How to read from a textfile
  • Write to a file - ASPCode.net Date added:(1/22/2000 4:24:17 PM) A little hitcounter
  • Append to a file - ASPCode.net Date added:(1/22/2000 4:25:17 PM) Here we open a file, and appends the current url to the end of the file.

General

Reading records

  • General tips - ASPCode.net Date added:(1/22/2000 4:02:34 PM) Reading records from a table is not hard, reading records in a optimized way is a little tougher. Often I see code like
  • General Open command - ASPCode.net Date added:(1/22/2000 4:04:10 PM) Reading records from a table is not hard, reading records in a optimized way is a little tougher. Often I see code like
  • I need just one single record - ASPCode.net Date added:(1/22/2000 4:05:48 PM) Optimize your code if you know only one record will be used
  • Looping through records - ASPCode.net Date added:(1/22/2000 4:06:56 PM) If you know you are gonna loop through a lot of records ( like when displaying a table of all articles in the system )

Updating records

  • Updating records - ASPCode.net Date added:(1/22/2000 4:09:32 PM) When updating records you basically have two choices.