473,503 Members | 1,834 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 1910
gm********@yahoo.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.solaris.

[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.solaris or comp.unix.programmer
is more likely to be able to help you.

--
Keith Thompson (The_Other_Keith) 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********@yahoo.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********@comcast.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_Keith) 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
1591
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...
2
2893
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...
3
2502
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...
3
1327
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...
7
2603
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...
1
11156
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...
10
6288
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...
8
3351
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...
1
2747
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...
0
7199
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
7274
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,...
0
7323
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...
1
6984
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
4670
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...
0
3162
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...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
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 ...
0
377
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...

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.