473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Directory path

cjw
Pl help me with this simple question.
I am using an array to store the file name,
eg. char in[] = "filename.bmp"; How can I give the directory path with
the file name?
Nov 13 '05 #1
12 4077

On Wed, 8 Oct 2003, cjw wrote:

Pl help me with this simple question.
I am using an array to store the file name,
eg. char in[] = "filename.bmp"; How can I give the directory
path with the file name?


char in_plus_path[] = "c:\\mystuff\\filename.bmp";
char unix_style[] = "/mystuff/filename.bmp";

What are you really trying to do?

-Arthur

Nov 13 '05 #2
In <Pi***********************************@unix46.andr ew.cmu.edu> "Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:

On Wed, 8 Oct 2003, cjw wrote:

Pl help me with this simple question.
I am using an array to store the file name,
eg. char in[] = "filename.bmp"; How can I give the directory
path with the file name?


char in_plus_path[] = "c:\\mystuff\\filename.bmp";


"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #3

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <Pi***********************************@unix46.andr ew.cmu.edu> "Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:

"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.


This works only on the NT/2000/XP versions of Windows. The 95/98/ME
versions do not accept the forward slashes.
Nov 13 '05 #4
In <bm*********@kcweb01.netnews.att.com> "Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> writes:

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <Pi***********************************@unix46.andr ew.cmu.edu> "Arthur

J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:


"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.


This works only on the NT/2000/XP versions of Windows. The 95/98/ME
versions do not accept the forward slashes.


As argument to the fopen function, such path specifications work since
MSDOS.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #5
Kris Wempa wrote:

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <Pi***********************************@unix46.andr ew.cmu.edu> "Arthur

J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:


"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.


This works only on the NT/2000/XP versions of Windows. The 95/98/ME
versions do not accept the forward slashes.


Not true. Even DOS 6.22 accepted forward slashes. It is COMMAND.COM
which doesn't.
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 13 '05 #6

On Thu, 9 Oct 2003, Dan Pop wrote:

"Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> writes:
"Dan Pop" <Da*****@cern.ch> wrote in message

"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.


This works only on the NT/2000/XP versions of Windows. The 95/98/ME
versions do not accept the forward slashes.


As argument to the fopen function, such path specifications work since
MSDOS.


Depends on your implementation of fopen(), doesn't it now? ;-)
(Yes, I think whatever DOS service that was allowed forward slashes,
but it's implementation-defined whether fopen() uses the DOS services ;-)

And besides, you might want to do other things with a filename
besides open it -- like, for instance, passing it to system().
And then if system() uses COMMAND.COM, you have problems.

-Arthur

Nov 13 '05 #7
"Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> wrote in message
news:bm*********@kcweb01.netnews.att.com...

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <Pi***********************************@unix46.andr ew.cmu.edu> "Arthur

J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:


"c:/mystuff/filename.bmp" looks much better as a Windows path.

Many non-Unix implementations support Unix-style paths, even if the
native convention is different.


This works only on the NT/2000/XP versions of Windows. The 95/98/ME
versions do not accept the forward slashes.


<OT>

All of mine certainly do (my Windows side of the room
has various machines running 95B, 98SE, NT4, and XP)

</OT>

-Mike
Nov 13 '05 #8

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <bm*********@kcweb01.netnews.att.com> "Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> writes: As argument to the fopen function, such path specifications work since
MSDOS.


Perhaps the forward slashes work for fopen(), but they don't currently work
if used in a system() call. This caused some problems in the past for a
Java applets that were trying to run certain commands based upon the
operating system. Windows 2000/NT accepted the forward slashes, but Windows
95 did NOT.
Nov 13 '05 #9
In <Pi**********************************@unix45.andre w.cmu.edu> "Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> writes:

On Thu, 9 Oct 2003, Dan Pop wrote:

"Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> writes:
>"Dan Pop" <Da*****@cern.ch> wrote in message
>>
>> "c:/mystuff/filename.bmp" looks much better as a Windows path.
>>
>> Many non-Unix implementations support Unix-style paths, even if the
>> native convention is different.
>
>This works only on the NT/2000/XP versions of Windows. The 95/98/ME
>versions do not accept the forward slashes.
As argument to the fopen function, such path specifications work since
MSDOS.


Depends on your implementation of fopen(), doesn't it now? ;-)


Indeed: one can conceive an implementation accepting *only* the forward
slashes ;-) But we're talking about the *real* implementations for DOS.
(Yes, I think whatever DOS service that was allowed forward slashes,
but it's implementation-defined whether fopen() uses the DOS services ;-)
It doesn't matter, as long as all known C implementations for DOS support
it ;-)
And besides, you might want to do other things with a filename
besides open it -- like, for instance, passing it to system().
And then if system() uses COMMAND.COM, you have problems.


system() is the only standard library function where the rules are
different. But the context of the thread was <stdio.h>...

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #10
In <bm*********@kcweb01.netnews.att.com> "Kris Wempa" <calmincents(NO_SPAM)@yahoo.com> writes:

"Dan Pop" <Da*****@cern.ch> wrote in message
news:bm**********@sunnews.cern.ch...
In <bm*********@kcweb01.netnews.att.com> "Kris Wempa"

<calmincents(NO_SPAM)@yahoo.com> writes:
As argument to the fopen function, such path specifications work since
MSDOS.


Perhaps the forward slashes work for fopen(), but they don't currently work
if used in a system() call.


Who was talking about system() calls?

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #11
cjw
Thanks. Both versions worked. I have program files and data files in
two different directories at the same level. Is there a short form of
specifying it rather than giving the full directory path?
cjw

"Arthur J. O'Dwyer" <aj*@nospam.andrew.cmu.edu> wrote in message news:<Pi***********************************@unix46 .andrew.cmu.edu>...
On Wed, 8 Oct 2003, cjw wrote:

Pl help me with this simple question.
I am using an array to store the file name,
eg. char in[] = "filename.bmp"; How can I give the directory
path with the file name?


char in_plus_path[] = "c:\\mystuff\\filename.bmp";
char unix_style[] = "/mystuff/filename.bmp";

What are you really trying to do?

-Arthur

Nov 13 '05 #12
In <de*************************@posting.google.com> s2******@student.rmit.edu.au (cjw) writes:
Thanks. Both versions worked. I have program files and data files in
two different directories at the same level. Is there a short form of
specifying it rather than giving the full directory path?


You can use relative paths. If your current working directory is the
parent directory of both the data directory and the program directory,
you can use something like: "data/file001.dat" and "prog/program1.exe".

Particularly useful in relative paths on certain systems (Unix and Windows
included) is the ".." thing which stands for the parent directory. In the
context of the previous example, assume that your current working
directory is prog and you want to specify the relative path of
file001.dat: "../data/file001.dat". You can use .. multiple times, to go
further backwards: "../../../foo/bar/baz.dat".

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #13

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

Similar topics

3
by: Peter Schwalm | last post by:
I'd like to modify the python search path depending on the source directory of the script being started. The reason is: I use a version control system, and the python scripts and modules are...
2
by: Dave Johnston | last post by:
Hi, I'm currently trying to create a wrapper that uses C functions but behaves like ifstream (from fstream.h) - this is because the platform I'm using (WinCE) doesn't support streams and this is...
8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
8
by: James Owens | last post by:
I'm a relative newbie, interested in storing the information from several server directories and subdirectories in XML so that I can present it selectively using XSL (all files updated today or...
1
by: Raquel | last post by:
Ok, so these are the two pieces of information regarding the location of archived logs during a rollforward recovery in a recoverable database: 1. OVERFLOWLOGPATH configuration parameter can...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
23
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
8
by: theWizard1 | last post by:
Using Asp.NET 1.1, and C#. I have a directory for the website, and a directory under it named Secure. I have a web.config in each of the above directories. The web.config in the Secure...
28
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
65
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.