473,614 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\Te mp\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 1842
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\Te mp\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.jp g"), 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.hel sinki.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\Te mp\File.jpg).


remove("\\\\Sun \\Temp\\File.jp g");

- Dario
Nov 14 '05 #3
Hi

I know that, thats not the problem.

Thanks.
Hans
"Dario (drinking coï¬?ee in the oï¬fceâ?¦)" <da***@despamme d.com> schrieb im
Newsbeitrag news:cb******** **@fata.cs.inte rbusiness.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\Te mp\File.jpg).


remove("\\\\Sun \\Temp\\File.jp g");

- 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\T emp\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.jp g");
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\Te mp\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.jp g");

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**@ralminNOS PAM.cc> schrieb im Newsbeitrag
news:c0******** *************** *******@news.te ranews.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\Te mp\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.jp g");

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
1662
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 provide me with an idiots guide to make the connection work from a windows client application? I get the following error:
8
11838
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, and use @"C:\file.txt"; it worked Thanks a lot
17
4882
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 some problems with this programm. I checked, the log files showed that the database was corrupted. The customer told me that there no 'illegal' operation such as pull out the plug, or kill the programm via task manager... So is there any...
2
6923
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>, </divtags? i.e. remove the last 4 characters and the first 3. The context in which the object occurs, in asp.net code, is:
10
2653
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 in a simple case. Analysis of the code suggests that the only possible explanation is that the following occurs, os.remove(x) ..... stuff if os.path.isfile(x):
3
2689
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, lsRecordType, lsXNbr, lsFiscYr, "Beg", CStr(H.BegBalAccDepn), CStr(H.BegBalCost), CStr(H.BegBalCostReval), CStr(H.BegBalDepCost), CStr(H.BegBalDepnReval)) The program is running from within a Virtual PC
0
344
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 trying to delete the lines from the log file before loading in the array took ages, i thought it would be alot quicker to put it in an array and remove the unwanted lines. Also the files it stored on a network drive so i think the array option is...
2
2897
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 time. Below is a working script that I used. Let's say after the file is uploaded to the server and a record created with the file contents above to the MS Access (using the script below). If I want to UPDATE that record let's say, change the...
2
2380
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 and store them locally on the user's machine. I want to be able to tell if a program is checked in or checked out. I am doing this by writing to a text file a 1 if it is checked in or a 0 if it is checked out. I am using StreamReader to read...
0
8124
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8621
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8427
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4119
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1421
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.