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

Home Posts Topics Members FAQ

Issue related to system() call and file handles.

Okay, this one's a tough one for me to explain so this might take a few
e-mails to get the idea across. Here's what I got though.

I have this application running on a Sun/Solaris machine, written in
C, using the Sun Forte Developer 7 C 5.4 Compiler released a few years
ago. Not exactly old but, you get the picture.

Now, most if not all the file handles on this machine are most likely
being used up by a secondary process and/or application. I can't help
it, they are just gone. So for file manipuation I've been using open,
write, etc. The older file handle functions. No big deal, it works
fine.

But, I have a system() call, that doesn't exactly fail, it just
doesn't exactly 'work' properly. Here's the issue.

The command makes a call to an Oracle command called 'exp'. It's an
exporting application. Helps dump the database into a raw file. For
input, I have this script I make on the fly that calls this application
and feeds it commands to run properly and dump the desired contents.
One problem though, it seems like, the exp command, can't create the
appropreate file (Although it does make the file, it ends up a 0 length
file) and does nothing productive.

If I run the same script that my application generated though, thru a
second shell, the script works just fine. Even when the main
application that I've created is still running in the background.

So, why is it, when I call this script using system("./myScript"); it
fails, but when I manually run ./myScript it runs fine?

Any ideas?

Tony

Nov 14 '05 #1
3 1916
gm********@yaho o.com writes:
Okay, this one's a tough one for me to explain so this might take a few
e-mails to get the idea across. Here's what I got though.

I have this application running on a Sun/Solaris machine, written in
C, using the Sun Forte Developer 7 C 5.4 Compiler released a few years
ago. Not exactly old but, you get the picture.

Now, most if not all the file handles on this machine are most likely
being used up by a secondary process and/or application. I can't help
it, they are just gone. So for file manipuation I've been using open,
write, etc. The older file handle functions. No big deal, it works
fine.
The open() and write() functions are non-standard (well, they're
POSIX, but the C standard doesn't mention them). To go slightly
off-topic, the standard C fopen() and fwrite() functions are often
implemented on top of the lower level open() and write() functions.
I'd be surprised if using the lower-level functions solved the problem
you're describing. But it's almost certainly a question for
comp.unix.solar is.

[snip]
So, why is it, when I call this script using system("./myScript"); it
fails, but when I manually run ./myScript it runs fine?


I doubt that we're going to be able to help you here, since it doesn't
sound like the problems you're having are related to anything defined
in the C language. Either comp.unix.solar is or comp.unix.progr ammer
is more likely to be able to help you.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #2
gm********@yaho o.com wrote:
Okay, this one's a tough one for me to explain so this might take a few
e-mails to get the idea across. Here's what I got though.

I have this application running on a Sun/Solaris machine, written in
C, using the Sun Forte Developer 7 C 5.4 Compiler released a few years
ago. Not exactly old but, you get the picture.

Now, most if not all the file handles on this machine are most likely
being used up by a secondary process and/or application. I can't help
it, they are just gone. So for file manipuation I've been using open,
write, etc. The older file handle functions. No big deal, it works
fine.

But, I have a system() call, that doesn't exactly fail, it just
doesn't exactly 'work' properly. Here's the issue.

The command makes a call to an Oracle command called 'exp'. It's an
exporting application. Helps dump the database into a raw file. For
input, I have this script I make on the fly that calls this application
and feeds it commands to run properly and dump the desired contents.
One problem though, it seems like, the exp command, can't create the
appropreate file (Although it does make the file, it ends up a 0 length
file) and does nothing productive.

If I run the same script that my application generated though, thru a
second shell, the script works just fine. Even when the main
application that I've created is still running in the background.

So, why is it, when I call this script using system("./myScript"); it
fails, but when I manually run ./myScript it runs fine?

Any ideas?

Tony

This is not a C language issue but..

when you run .\myScript from the shell prompt, you get a 'new'
invocation to the shell to run it. Does 'system("./myScript")' invoke a
new shell? I don't know. Try 'system("sh ./myScript")' perhaps.

...but not a C language issue.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #3
Joe Wright <jo********@com cast.net> writes:
[...]
This is not a C language issue but..

when you run .\myScript from the shell prompt, you get a 'new'
invocation to the shell to run it. Does 'system("./myScript")' invoke
a new shell? I don't know. Try 'system("sh ./myScript")' perhaps.

..but not a C language issue.


<OT>
The Solaris man page for system ("man system") will answer this.
</OT>

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1605
by: HakonB | last post by:
Hi all I get an exception when trying to deserialize a simple configuration file using XML Serialization. The very long stacktrace can be seen at the bottom of this message. I've see other messages related a similar error but none of the solutions suggested are valid in case :/ I have tracked the problem down to the compilation of the temporary DLL that handles the actual serialization. The following commandline (that is one single...
2
2903
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
3
2510
by: Jeffery Franzen | last post by:
Anyone know where the documentation is regarding Activex controls in asp web forms? I'm using VS.NET 2002 enterprise and am trying to use Activex controls in vb.net web form app. I do the add control to pallete and then add a reference. I get the interop dll added to bin folder. I did this with the MediaPlayer activex control as a simple case to to try and get it working. I set the control to autostart via the html parameter tag for...
3
1332
by: Chris Calzaretta | last post by:
I need to create a form from this web service http://24.163.239.122/wsprojecttrackerobjects/wsprojecttrackerobjects.asmx if you call getloginscreen there is a field called screendescription that field screendescription has the form code I am trying to create at runtime the code that is in the field screendecription is Imports System.Windows.Forms Public Class clsLoginScreen Inherits System.Windows.Forms.Form
7
2613
by: Simon Verona | last post by:
I have a problem in my application which I believe is due to open handles.. . The symptom that users report is that after they have been using the application for a while, it will randomly just crash with an exception report (I've not got the details of the error, but I'm working on that now!). I'm trying to reproduce the circumstances by simulating a typical batch of user tasks on my pc and monitoring whats happening. I'm guessing it's...
1
11175
by: kig25 | last post by:
Hello, When using the VB.NET PrintDocument class, I seem to be encountering an issue where the sub pd_PrintPage handles PrintDocument.PrintPage (upon continuing if HasMorePages = true) will paint the next page on top of the original page. In a sample data case where the source is long enough to fill three pages, I end up with four calls to pd_PrintPage which render onto two printed sheets. Historical posts in this forum from 2003 and...
10
6329
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden so that the window for the Console application is not visible. However, when using some of the 'advanced' properties of the StartInfo object, like Username, Password and Domain, the WindowsStyle property of the StartInfo object is ignored....
8
3364
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location on a network for files and then copies these files to another location (on the network) AND then updates a record in the database. The file copying is performed before the database update because the file system is not transactional. The code...
1
2752
by: Nadeem Ashraf | last post by:
Hi, We are developing a web based application "UltraLearn.com" with a mix of junior/senior Microsoft technologies. That includes Microsoft Silverlight, ASP.Net Ajax and WCF/WF. Recently, we have hit the wall with some of tested/proven technologies. The problem statement follows: We are calling a WCF Service from our site pages to track user navigation. The service in turn makes call to a gateway/server (using HttpWebRequest,...
0
8197
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8640
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
8443
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...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
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
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
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
1438
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.