473,563 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to open a file in the current directory

Set fileSystem = Server.CreateOb ject( "Scripting.File SystemObject" )
Set file = fileSystem.Open TextFile( "config.xml ", 1, False )

It's saying that 'config.xml' doesn't exist. How can I reference this file?
It's in the same directory as the file with the above code. Do I need to
build the path somehow?


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 19 '05 #1
2 4999
Set file = fileSystem.Open TextFile(Server .MapPath("confi g.xml"), 1, False)

This assumes Windows 2000 or later.

Ray at home

--
Will trade ASP help for SQL Server help
"Anonymous" <Nobody> wrote in message news:3f******** @127.0.0.1...
Set fileSystem = Server.CreateOb ject( "Scripting.File SystemObject" )
Set file = fileSystem.Open TextFile( "config.xml ", 1, False )

It's saying that 'config.xml' doesn't exist. How can I reference this file? It's in the same directory as the file with the above code. Do I need to
build the path somehow?


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Jul 19 '05 #2
Server.MapPath( "config.xml ")
Otherwise the FSO object is usually based out of C:\<windows>\Sy stem32\
--
----------------------------------------------------------
Curt Christianson (Software_AT_Da rkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"Anonymous" <Nobody> wrote in message news:3f******** @127.0.0.1...
Set fileSystem = Server.CreateOb ject( "Scripting.File SystemObject" )
Set file = fileSystem.Open TextFile( "config.xml ", 1, False )

It's saying that 'config.xml' doesn't exist. How can I reference this file? It's in the same directory as the file with the above code. Do I need to
build the path somehow?


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
107046
by: Daniel | last post by:
How do you get the current directory of the actual .exe file (not the file name but the directory it is in) ? These do not work: System.IO.Directory.GetCurrentDirectory() - returns system directory not current directory of .exe System.Environment.CurrentDirectory - returns system directory not current directory of .exe...
4
16357
by: Jon Rea | last post by:
Hi, Just a quickie ... I thought that Directory.GetCurrentGirectory(), unless the current directory had been changed by the program, would always point to the directory where the .exe for the program was. However, if my program is launched from the start menu in windows XP, Directory.GetCurrentGirectory() returns a special windows...
3
3408
by: Alur | last post by:
Changing the current directory with the help of dialog window(MFC app) We can change directory with the help of the following code: CFileDialog m_ldFile(TRUE); m_ldFile.m_ofn.lpstrInitialDir="c:\\"; // the initial folder. //below the dialog window is opened, then tfolders and eventually a file and after automatically current directory is...
1
8687
by: MrNobody | last post by:
I want to load a document which would be residing in the same directory as the application so I pass in a string to WebBrowser control which has no path information- normally doing this with regular File IO it knows to go to current directory but not WebBrowser. What do I need to change? Is there some System property which stores the path the...
15
10834
by: Sandra-24 | last post by:
Comparing file system paths as strings is very brittle. Is there a better way to test if two paths point to the same file or directory (and that will work across platforms?) Thanks, -Sandra
3
3179
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current directory (os.curdir) was on sys.path. In 2.5, it appears to be the base directory of the running script. For example, if you execute the file testme.py in...
6
7536
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control isn't the current directory of the program. What is the current directory? I don't want to use an absolute path, since its contents are saved to...
2
2415
by: Tim Kelley | last post by:
I have a project that includes images as part of the project. I have a grid (Infragistics) with a button that the user clicks and it brings up a file open dialog that is used to browse to a file so the path can be saved in the grid. After the dialog is closed the program cannot find any of the images that are part of the project. I believe...
12
8524
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but got errors of Failed to open file ./outdir/mytestout.txt. Below is the code: #include <stdio.h> int main(void)
8
5201
by: Mateusz Viste | last post by:
Hi, I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)... I recently put the following script online: <script type="text/javascript"><!-- function playmedia(mediafile) { newwindow=window.open(); if...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.