I’m collecting some data from my game, and I want to write it to a file. I’m using a streamwriter, and it worked when all I wanted it to do was write the data to a file.
eg. path = “/this/is/a/filepath/data.csv”
However, when I wanted to add a timestamp, so that it would create a set of unique files
It starts throwing a DirectoryNotFound exception as well as NullReferenceExceptions (which it did not before), but I’m pretty sure that is a product of this filepath issue. Why might this be happening?
I know @Scabbage tried to reply, but maybe it wasn’t precise enough. So, your problem probably is that the date format contains ‘/’ characters. Which becomes “/this/is/a/filepath/data” + “03/28/2018” + “.csv” or something like that.
The plain and simple solution is to replace these characters.
Thanks. The character it didn’t like was colons. I initially thought it had something to do with static/nonstatic, but I started off removing the wrong characters.