Re: fopen() with full path affecting subsequent fopen calls



On Apr 28, 3:14 pm, Michel Rouzic <Michel0...@xxxxxxxx> wrote:
I made a program that accepts as parameters an input file name that
we'll call file1, and an output file name that we'll call file2, and
opens on its own a configuration file called file3. My program works
correctly when calling it like this : ./program file1 file2, and also
with full paths, like this : ./program c:\dir\file1 c:\dir\file2

However, a most puzzling phenomenon occurs when I use the full path
only for the first file, like this : ./program c:\dir\file1 file2.
Normally I would expect file2 to be written in the same place as it
did when I didn't use the full path for file1. Only that's not what
happens. File2 gets successfully written to, as well as file3 (which
my program loads data from and saves data into), only not where I
expect, and actually, I don't have a single clue where they can be.
They're surely getting written to a valid place because the program
operates normally and file3, the one from the mysterious location,
gets read from normally.

So here's my problem stated in a more concise manner : if I call
fopen() using a full path, it affects subsequent fopen() calls in that
if they don't call absolute paths they will try to reach the files in
an unknown location, which is definitely not what I want.
Of course it does not. We can't be 100% sure of what actually happends
without seeing your code.
Try to isolate the problem in the least lines possible before you post
it.
.



Relevant Pages

  • Re: Need Help
    ... eg: file1, file2, file3 etc ... into, max 5-6, chunk files and then loading these chunk files into ...
    (comp.unix.shell)
  • RE: [SLE] File Counts

    (SuSE)
  • Re: fopen() with full path affecting subsequent fopen calls
    ... Normally I would expect file2 to be written in the same place as it ... did when I didn't use the full path for file1. ... as well as file3 (which ... It's very likely a "current working directory" problem of some sort, ...
    (comp.lang.c)
  • Re: Problems with tar (tcllib)
    ... I have a simple script that uses the tcllibtarcommand. ...
    (comp.lang.tcl)
  • Re: Need Help
    ... eg: file1, file2, file3 etc ... This means that if script is executing file1, ...
    (comp.unix.shell)