Hello all,
When there's no file path in the streamwriter constructor does anyone know the location the file gets output to?
ie
Thanks,Code:Dim sw as StreamWriter = new Streamwriter("test.txt")
sw.close
Strick
Printable View
Hello all,
When there's no file path in the streamwriter constructor does anyone know the location the file gets output to?
ie
Thanks,Code:Dim sw as StreamWriter = new Streamwriter("test.txt")
sw.close
Strick
The file gets output to the working directory, which is usually the folder containing the executable. The user can change the working directory using a shortcut, though, and you can also change the working directory using ChDir and SetWorkingDirectory.
To always write to the application's folder, use:
Code:Application.StartupPath & "\test.txt"
The "current" directory. Could be where the app is located. Could be the root.... could be anywhere. Generally speaking, it's a good idea to include the path where you want the file to be.
-tg