473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Remove a file over the network on a Sun

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
6 1828
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
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
Hi

I know that, thats not the problem.

Thanks.
Hans
"Dario (drinking coï¬?ee in the oï¬fceâ?¦)" <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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Blair | last post by:
Hi, I am struggline to make my VB.Net windows client connect remotely to a MSDE database. The database is accessed ok from the remote PC when i used web forms (aspx) to access it. Can anyone...
8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
17
by: shineofleo | last post by:
Here is the situation: I wrote a VB programm, which stores all the information in a single Access database file using jet engine. It worked well, however one of my customs reported that there was...
2
by: Harry Haller | last post by:
Can I remove text from a StringWriter ? I have a StringWriter object, the content of which looks like this: "<div>Some other html which I wish to keep</div>" Can I remove the unwanted <div>,...
10
by: ppaterson | last post by:
Can os.path.isfile(x) ever return True after os.remove(x) has successfully completed? (Windows 2003, Python 2.3) We had a couple of failures in a server application that we cannot yet reproduce...
3
by: Barry Flynn | last post by:
Hi I am working with a VB 2005 program which has been converted from VB6. It writes data out to a flat file, with code like the following line WriteLine(riFileNo, "Hist", lsAssetID,...
0
by: Barkingmadscot | last post by:
I am stuck, i cant work out how to remove lines from an array I am loading a text file (a Log) into an array, I know which lines a need, but the logs can be upto 30K sometimes bigger. I found...
2
by: hotflash | last post by:
Hi Master CroCrew, I found a good PURE ASP that will allow you to upload 10MB file to the server and the file contents such as Network, Author, Title, etc... will insert to MS Access at the same...
2
by: Steve | last post by:
I am working on a program that works like a check in/check out system. There is a folder on a network drive that stores a bunch of vb programs. This program will check in and check out programs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.