This message was originally submitted by [log in to unmask] to the CCC list at
LISTS.UFL.EDU. You can approve it using the "OK" mechanism, ignore it, or
repost an edited copy. The message will expire automatically and you do not
need to do anything if you just want to discard it. Please refer to the list
owner's guide if you are not familiar with the "OK" mechanism; these
instructions are being kept purposefully short for your convenience in
processing large numbers of messages.
----------------- Original message (ID=150D5D5A) (64 lines) -------------------
Return-Path: <[log in to unmask]>
Received: from smtp.ufl.edu (sp42en1.nerdc.ufl.edu [18.104.22.168])
by spnode30.nerdc.ufl.edu (8.12.8/8.12.3/2.3.0) with ESMTP id hB9EivTa061194
(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL)
for <[log in to unmask]>; Tue, 9 Dec 2003 09:44:57 -0500
Received: from nersp.nerdc.ufl.edu (sp43en1.nerdc.ufl.edu [22.214.171.124])
by smtp.ufl.edu (8.12.10/8.12.7/2.4.2) with ESMTP id hB9EimAW093830
for <[log in to unmask]>; Tue, 9 Dec 2003 09:44:50 -0500
Received: from localhost (cwlogan@localhost)
by nersp.nerdc.ufl.edu (8.12.10/8.12.6/2.1.0) with ESMTP id hB9Eilin139794;
Tue, 9 Dec 2003 09:44:47 -0500
X-Authentication-Warning: spnode43.nerdc.ufl.edu: cwlogan owned process doing -bs
Date: Tue, 9 Dec 2003 09:44:46 -0500 (EST)
From: Chuck Logan <[log in to unmask]>
X-X-Sender: [log in to unmask]
To: "Sposato, John" <[log in to unmask]>
cc: [log in to unmask]
Subject: Re: delete file in c++
In-Reply-To: <[log in to unmask]>
Message-ID: <[log in to unmask]>
References: <[log in to unmask]>
Organization: University of Florida Network Services
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Scanned-By: NERDC Open Systems Group (http://open-systems.ufl.edu/services/virus-scan/)
I don't know what the problem is, but here's a couple things I would look
First, take Jim's suggestion of checking the "errno" value; the -1 return
for unlink and remove means "error", not "file open"; errno gives you
the real error code and that might yield a clue.
Second, since it works when you cut and paste the command, maybe there's
a non-printing character in the string somewhere (space, newline, whatever)
that's confusing the system call.
Third, could the program and the command window have different environments
or drive mappings somehow?
Chuck Logan 112 Bryant Space Sciences Bldg.
Network Security Engineer (352) 392-2061
OIT Network Services, University of Florida [log in to unmask]
On Mon, 8 Dec 2003, Sposato, John wrote:
> Hoping maybe someone in the CCC group can help:
> I have tried unsuccessfully to delete a file using remove() and _unlink().
> I pass them a c_str converted file name that includes the path. The files
> reside on a network drive that is mapped to a drive letter (i.e., g:). It
> always returns a -1 (file open), even though none of the files are open.
> Even the system() command doesn't work (system("del foo.txt"). Yet, if I
> copy the command that gets echoed to the logfile and paste it into a command
> window it deletes the file. I am very confused, can someone help?
> John Sposato Jr