C# FileStream default location

Discussion in 'Software' started by be0, Aug 20, 2008.

  1. be0

    be0 Corporal

    Hi everyone,

    I am using a Filestream to write to a file with a .csv extension. However the file is being placed to
    C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE directory.
    I want it to be placed to a folder withing my application.

    I am using the following commant to create the file:
    FileStream fs = newFileStream(FileName, FileMode.CreateNew);

    Also there are some goofy characters coming up in front of my data:
    01234 Well the examples wont show here I dont know why,

    Whats up with that?

    Thanks everyone.
     
  2. PC-XT

    PC-XT Master Sergeant

    That's strange. Have you tried ".\\"+FileName? Or does an absolute path work?
    Maybe it's using
    Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
    while executing a dll, instead of
    Application.ExecutablePath
    (Application is in System.Windows.Forms if you want to use it)
    http://www.gamedev.net/community/forums/topic.asp?topic_id=406208
     
    Last edited: Aug 20, 2008
  3. be0

    be0 Corporal

    I tried the .\\ and no go. Absolute path works.
    Thanks. I also figured out the other thing...
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds