Thread: Path Questions StreamReader??

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    44

    Exclamation Path Questions StreamReader??

    Hello,

    I'm reading a file from a network drive but I'm having a problem in this line.
    Code:
    StreamReader fileRead = new StreamReader("\\E-Storage\\Billing\\text.txt")
    The reason that I don't specify the drive is because I will be reading a file from a network drive which sometimes could be map to different drive letters.

    My question is how should I write the path then

    Code:
    ("\\E-Storage\\Billing\\text.txt") or
    (@"\E-Storage\Billing\text.txt")
    I tried both and program did not work however when I specified a letter such as c:\text.txt it works fine so could you correct me if I'm wrong.

    Thank you

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    I'm far from being sure about this, but I think you might try it though:

    "%root%\\E-Storage\\Billing\\text.txt"

    I think I've seen this somewhere = /

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    This worked for me:
    Code:
    (@"\\Bdonaldsondev\documentation\bgd3.txt") or
    ("\\\\Bdonaldsondev\\documentation\\bgd3.txt")
    Remember that you need two slashes on the beginning for network paths, not one.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Shortest Path Maze Solver (Breadth Search Help)
    By Raskalnikov in forum C Programming
    Replies: 5
    Last Post: 04-07-2009, 07:41 PM
  2. Can't figure out what keeps hanging up my program
    By shays in forum C Programming
    Replies: 7
    Last Post: 11-12-2007, 02:59 PM
  3. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  4. Path Choice Questions
    By Dae in forum Game Programming
    Replies: 8
    Last Post: 07-02-2005, 05:34 AM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM