"Viviana Vc" <vcotirlea@hotmail.com> wrote in message
news:c4954l$2ejb94$1@ID-78102.news.uni-berlin.de...
> Hi all,
>
> Now that I found out what is the problem I have another question.
> I have my main application let's name it a.exe that launches the second
> app let's name it b.exe.
> The a.exe is opening a log file at the begining, and when this file
> exceeds a specific limit that file should be deleted. The deletion fails
> because the b.exe is having the same file open.
>
> Seems that the problem is that the a.exe uses the spawnv() function to
> start the b.exe: spawnv(_P_NOWAIT, cvec.argv[0], cvec.argv);
>
> In MSDNL is stated:
> "Files that are open when a _spawn call is made remain open in the new
> process."
> but later it's also stated:
> "You can control whether the open file information of a process is
> passed to its spawned processes. The external variable _fileinfo
> (declared in STDLIB.H) controls the passing of C_FILE_INFO information.
> If _fileinfo is 0 (the default), the C_FILE_INFO information is not
> passed to the new processes. If _fileinfo is not 0, C_FILE_INFO is
> passed to new processes."
>
> So, as I understood if _fileinfo is 0, which is the default the files
> opened by a.exe should nopt be opened in the b.exe process right? Still
> looks like they are opened.
>
> How can I do, so that the files that are opened in the a.exe process,
> not to be opened in b.exe process, using the spawnv function?
>
> Thanks in advance,
> Viv
>
> On Fri, 26 Mar 2004 14:37:04 -0500, "John Phillips"
> <jjphillipsREMOVE@REMOVEhotmail.com> wrote :
>
> >Check out Process Explorer from
www.sysinternals.com. View all the
handles
> >of "File" type for the currently running processes, and you'll have your
> >answer.
>