|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
current working directory problemto find any references on this topic. It seems like my current working directory is consistently a few directories up from where I am storing the file - not what I would have expected. I would have expected it to be the same directory as the dir with my code - I guess I was wrong because thats not what is happening. On my own computer it wasn't a big problem because I dodged the problem by put my data in the root wherever that may have been. However, now that I have uploaded my files to the internet, I don't have that kind of control of my file system and I don't know the structure to make an absolute work path. Dim oRead as System.IO.StreamReader Dim oFile as System.IO.File oRead = oFile.OpenText("Library.txt") the code is simple enough. is there anyway to resolve this? perhaps by setting the current working directory or some other solution? it seems that sticking my data files in the same directory as the app isn't enough. the fact that my directory hierarchy is unpredictable is complicating things beyond my ability. thanks in advance. as i am writing this the idea ccured to me that maybe I should just find out the directory hierarchy from my host. Jeff wrote:
Show quoteHide quote > I feel like I should have been able to figure this out but I can't seem If you can put the file in the same directory as the app then do:> to find any references on this topic. > > It seems like my current working directory is consistently a few > directories up from where I am storing the file - not what I would have > expected. I would have expected it to be the same directory as the dir > with my code - I guess I was wrong because thats not what is happening. > > On my own computer it wasn't a big problem because I dodged the > problem by put my data in the root wherever that may have been. > However, now that I have uploaded my files to the internet, I don't > have that kind of control of my file system and I don't know the > structure to make an absolute work path. > > Dim oRead as System.IO.StreamReader > Dim oFile as System.IO.File > oRead = oFile.OpenText("Library.txt") > > the code is simple enough. is there anyway to resolve this? perhaps by > setting the current working directory or some other solution? it seems > that sticking my data files in the same directory as the app isn't > enough. the fact that my directory hierarchy is unpredictable is > complicating things beyond my ability. thanks in advance. > > as i am writing this the idea ccured to me that maybe I should just > find out the directory hierarchy from my host. > Dim oRead as System.IO.StreamReader Dim oFile as System.IO.File oRead = oFile.OpenText(Application.StartupPath & "\Library.txt") The file is in the same directory as the app however it seems that the
current working directory is completely somewhere else. My probelm is compounded because the start up path is arbitrary. This is a misunderstanding that has been around forever. Yes, your "working
directory" can seem to be arbitrary. It is set by the OS when your program starts and is determined either by the shortcut that starts your program (right click on a shortcut and check the "Start In" field), where the program is started from (Windows Explorer, command prompt, spawned from some other program and this inheriting that other programs working dir, etc), and other stuff. "I don't like Spam's" answer should solve your problem. Show quoteHide quote "Jeff" <jeffmag***@gmail.com> wrote in message news:1139087291.246965.282600@g44g2000cwa.googlegroups.com... > The file is in the same directory as the app however it seems that the > current working directory is completely somewhere else. My probelm is > compounded because the start up path is arbitrary. > Hi pal,
I was breaking my head to get the current working directroy..Thanks a lot..... --- Posted via www.DotNetSlackers.com
Problem to write a good serie of bytes in a file.
Printing using margins Subclassed Textbox OnLeave Overrides Additional information: Cast from string "" to type 'Double' is not valid. error Variable declarations.... in VB.Net Report writers for VB.NET Visual Basic 2005 PostMessage ComboBox Making Bitmaps and Graphics objects - two ways taskbar icon |
|||||||||||||||||||||||