473,320 Members | 2,189 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,320 software developers and data experts.

Standard way of dealing with directories

Hi!
I want to produce a number of output filenames, which contain a
directory part, and a file aprt (e.g., /home/user1/dir1/file.dat would
be one). I have the directory in one char array, and the filename in a
different one. Using strncat and strncpy one can manage that, but i
would like the code do intelligently deal with the forward (UNIX) and
backwards-slash (Windows) directory naming convention. Is there a
standard way of creating this things, rather strtok-ing the string for
/ and substituting for \ with a compiler conditional?

Thanks
Jose

Nov 15 '05 #1
1 911


jo*******@gmx.net wrote:
Hi!
I want to produce a number of output filenames, which contain a
directory part, and a file aprt (e.g., /home/user1/dir1/file.dat would
be one). I have the directory in one char array, and the filename in a
different one. Using strncat and strncpy one can manage that, but i
would like the code do intelligently deal with the forward (UNIX) and
backwards-slash (Windows) directory naming convention. Is there a
standard way of creating this things, rather strtok-ing the string for
/ and substituting for \ with a compiler conditional?

Thanks
Jose


Hi,

Questions like this aren't really on topic on comp.lang.c.
But since you are asking about multiple OS where to go is sometimes
tricky -- perhaps comp.programming?

<OT> I think that forward slashes are likely to work from within a
program --
if you aren't displaying to user who has expectations based on what
works from the command line, it may just work. Give it a try. May be
wrong, it has been a while since I used Win for programming </OT>
-David

Nov 15 '05 #2

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

Similar topics

9
by: FISH | last post by:
Ever have one of those days when you're not sure if it's you who's gone mad, or the rest of the world? I have an Open Source project on SourceForge for communication with YSMG - Yahoo's IM...
4
by: paul | last post by:
hey there all! i'm writing some little programs, and i'd like to know about how to deal with directories on unix. i've read up on this, but the docs don't really mention much on it. do i use the...
25
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
71
by: Christopher Benson-Manica | last post by:
At what point was the .h dropped from the STL headers? I just had a discussion yesterday with my boss, who said he wanted .h on all the STL includes, despite me protesting that it was not...
2
by: Greg W. | last post by:
In our setup project, we have the standard web application folder, but we also have 4 web custom folders (virtual directories) that are created at the same level as the web application folder...
22
by: David Mathog | last post by:
One thing that keeps coming up in this forum is that standard C lacks many functions which are required in a workstation or server but not possible in an embedded controller. This results in a...
2
by: Kevin D. Smith | last post by:
I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be...
3
by: Joakim Hove | last post by:
Hello, I am reading a filename from the user - the loop is typically like this: 1. Read a directory from the user. 2. Read several filenames from the user. The filenames read in 2. above...
4
by: bobby | last post by:
Hello group, I just wanted to know where are system standard include and libraries directories in Ubuntu? I searched in usr/include and usr/local/include and I could not find any header?!! I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.