# Thread: Creating a file with a program

1. ## Creating a file with a program

Hey, what is the code to create a file in a different directory than the one the C program is in? Say the program is in c:\x\yy, and I want the program to create a text file in c:\x\zz\top.

2. fopen("full/path/to/dir/filename", "w");

3. or

fopen("full\\path\\to\\dir\\filename", "w");

4. Or
Code:
fopen ( "full:path:to:dir:filename", "w" );
Or some other implementation dependent way of specifying file structure paths. C doesn't care as long as the path eventually resolves to something valid.

5. Prelude.

Which filesystem/OS uses colons as a separator?

6. Macintosh before they began to use Darwin as the environment behind OS X.

7. Cool. Yeah I was just informed that on IRC too.

What was the equivalent of ../ then? ..:?

8. >What was the equivalent of ../ then?
Clicking on the up arrow?