By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,407 Members | 1,753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,407 IT Pros & Developers. It's quick & easy.

Remove a file over the network on a Sun

P: n/a
Hi

I have a C application on a Windows PC who shoul delete files on a Sun which
is in the same network. I try this with the 'remove' command, e.g.
remove(\\Sun\Temp\File.jpg). But this doesn't work. The return code from
remove is not 0 and the errno is 22 (invalid argument).

What could be wrong?

I have access to the Sun and have tried this with the directory mounted or
not mounted and I have tried the same (delete a file) on a Windows and a Mac
OS X machine in the netwroks. This works fine.

Thanks for any help.

Regards
Hans
Nov 14 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hans Stoessel <hs************@pm-medici.ch> scribbled the following:
Hi I have a C application on a Windows PC who shoul delete files on a Sun which
is in the same network. I try this with the 'remove' command, e.g.
remove(\\Sun\Temp\File.jpg). But this doesn't work. The return code from
remove is not 0 and the errno is 22 (invalid argument). What could be wrong?
Assuming that the above was just a typo and the correct function call
was remove("\\\\Sun\\Temp\\File.jpg"), the answer is that it depends
entirely on your operating system and is not related to C at all.
I have access to the Sun and have tried this with the directory mounted or
not mounted and I have tried the same (delete a file) on a Windows and a Mac
OS X machine in the netwroks. This works fine.


This is irrelevant as far as C is concerned.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"A bicycle cannot stand up by itself because it's two-tyred."
- Sky Text
Nov 14 '05 #2

P: n/a
Hans Stoessel wrote:
I have a C application on a Windows PC who shoul delete files on a Sun which
is in the same network. I try this with the 'remove' command, e.g.
remove(\\Sun\Temp\File.jpg).


remove("\\\\Sun\\Temp\\File.jpg");

- Dario
Nov 14 '05 #3

P: n/a
Hi

I know that, thats not the problem.

Thanks.
Hans
"Dario (drinking co?ee in the ofce?)" <da***@despammed.com> schrieb im
Newsbeitrag news:cb**********@fata.cs.interbusiness.it...
Hans Stoessel wrote:
I have a C application on a Windows PC who shoul delete files on a Sun which is in the same network. I try this with the 'remove' command, e.g.
remove(\\Sun\Temp\File.jpg).


remove("\\\\Sun\\Temp\\File.jpg");

- Dario

Nov 14 '05 #4

P: n/a
In <2j*************@uni-berlin.de> "Hans Stoessel" <hs************@pm-medici.ch> writes:
I have a C application on a Windows PC who shoul delete files on a Sun which
is in the same network. I try this with the 'remove' command, e.g.
remove(\\Sun\Temp\File.jpg). But this doesn't work. The return code from
remove is not 0 and the errno is 22 (invalid argument).

What could be wrong?


Your remove call is certainly wrong. Try one of the following:

remove("\\\\Sun\\Temp\\File.jpg");
remove("//Sun/Temp/File.jpg");

and be sure that your capitalisation is correct.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #5

P: n/a
"Hans Stoessel" <hs************@pm-medici.ch> wrote:
I have a C application on a Windows PC who shoul delete files on
a Sun which is in the same network. I try this with the 'remove'
command, e.g. remove(\\Sun\Temp\File.jpg). But this doesn't work.
The return code from remove is not 0 and the errno is 22 (invalid
argument).

What could be wrong?


Maybe you didn't write the string correctly (correct capitalisation?), or
maybe your `remove' function does not support UNC paths (very unlikely for a
program run on Windows).

Try:
result = remove("\\\\Sun\\Temp\\File.jpg");

Yes, all those backslashes are required. The reason is that in a C string or
character literal, the backslash introduces an escape sequence (hexadecimal,
octal or control character). A double backslash is interpreted as a single
real backslash.

It works on Cygwin GCC. It works on Borland C++. It works on LCC-Win32. It
works on the Microsoft compiler. It even works on the 1998 DOS compiler
Turbo C 2.01!

--
Simon.
Nov 14 '05 #6

P: n/a
Hi

Sorry, that was my fault: In fact I use the double backslash of course. I
use remove as remove(sPath.c_str()).

But whats about UNC paths? Whats that? By the way: I can create, write and
read the file but I can't remove it. Maybe something with the permission?
The problem is that the SUN is not located in my company...

Thanks for the help
Hans
"Ralmin" <ne**@ralminNOSPAM.cc> schrieb im Newsbeitrag
news:c0******************************@news.teranew s.com...
"Hans Stoessel" <hs************@pm-medici.ch> wrote:
I have a C application on a Windows PC who shoul delete files on
a Sun which is in the same network. I try this with the 'remove'
command, e.g. remove(\\Sun\Temp\File.jpg). But this doesn't work.
The return code from remove is not 0 and the errno is 22 (invalid
argument).

What could be wrong?
Maybe you didn't write the string correctly (correct capitalisation?), or
maybe your `remove' function does not support UNC paths (very unlikely for

a program run on Windows).

Try:
result = remove("\\\\Sun\\Temp\\File.jpg");

Yes, all those backslashes are required. The reason is that in a C string or character literal, the backslash introduces an escape sequence (hexadecimal, octal or control character). A double backslash is interpreted as a single
real backslash.

It works on Cygwin GCC. It works on Borland C++. It works on LCC-Win32. It
works on the Microsoft compiler. It even works on the 1998 DOS compiler
Turbo C 2.01!

--
Simon.

Nov 14 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.