On 15 Apr 2008, at 20:38, F Andersen wrote:
> Hello
>
> I've written a small Mac-OS-X FLTK app that writes a file using
> fopen(),
> fwrite(), fclose().
>
> The call to fopen is something like fopen("test.txt", "w").
>
> The executable is on my desktop.
>
> When I run it, the file test.txt is written to the root directory '/'
> instead of my desktop.
yes - what any exe gets passed as CWD when you launch it by clicking
varies from OS to OS - and on unix machines it actually varies with
window manager, too.
So, you can't assume you know what CWD is, or that CWD points to the
location of the exe (it actually does on win32 systems, for
historical reasons, but rarely on other OS.)
Exe's launched from a shell will generally be passed the CWD of the
parent shell, which is obviously rather more predictable!
This comes up fairly often in the group, erm, searching.... try this
one:
http://www.fltk.org/newsgroups.php?gfltk.general+v:22083
--
Ian
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk