I am currently learning C++ and am into a project for the end of the
semester finals. Everything is rosy except for one feature that I want
to include and can't find in my very large and expensive C++ books. Plus,
I don't want to ask the instructor because that will give my project away.
How do you call an external non C++ program, or possibly a system
function? For instance, I have some very good Perl modules from my last
class that parse text files and I would like to call them from a menu in
my C program. (Why the heck, you say? Because in theory, my program can
call external scripts that can be changed by the assumed user and if they
were compiled into MAIN then they would be fixed functions. Remember,
this is for credit, not deployment.)
But I don't find anything (or maybe don't recognize it) in
my manuals - calling, external calls, external functions, system, system
calls, etc - apparently none of the above. I even spent some time in the
local Booksamillion looking through their stacks (for free, I admit it)
and didn't find the keyword I am looking for.
What is interesting is that I can easily call a C program from a Perl
script, but not the other way around.
Anybody?
Thanks all
Hagar (but not too horrible). 8 1517
Therez a C function by name - 'system (<path_to_exec > ) ' that can do
what you want ! Check it out in google.
Hagar wrote: I am currently learning C++ and am into a project for the end of the semester finals. Everything is rosy except for one feature that I want to include and can't find in my very large and expensive C++ books. Plus, I don't want to ask the instructor because that will give my project away.
How do you call an external non C++ program, or possibly a system function? For instance, I have some very good Perl modules from my last class that parse text files and I would like to call them from a menu in my C program. (Why the heck, you say? Because in theory, my program can call external scripts that can be changed by the assumed user and if they were compiled into MAIN then they would be fixed functions. Remember, this is for credit, not deployment.)
But I don't find anything (or maybe don't recognize it) in my manuals - calling, external calls, external functions, system, system calls, etc - apparently none of the above. I even spent some time in the local Booksamillion looking through their stacks (for free, I admit it) and didn't find the keyword I am looking for.
What is interesting is that I can easily call a C program from a Perl script, but not the other way around.
Anybody?
Thanks all Hagar (but not too horrible).
--
--
Rakesh Kumar
** Remove nospamplz from my email address for my real email **
Hagar wrote: How do you call an external non C++ program, or possibly a system function? For instance, I have some very good Perl modules
....
What is interesting is that I can easily call a C program from a Perl script, but not the other way around.
To pass arbitrary commands to your execution environment, use the
"system" function from <cstdlib>. Perl also has excellent facilities
for being embedded in C and C++ programs. http://search.cpan.org/~abergman/pon.../perlembed.pod
3rd-party libraries are available to make it even easier. E.g., see: http://search.cpan.org/~jtobey/pickle-0.5.1/pickle.pod
> But I don't find anything (or maybe don't recognize it) in my manuals - calling, external calls, external functions, system, system
Thanks guys. Interestingly, system is what perl uses to call outside the
main code. But... There is not a single reference to the system command
in either of my C++ books, or popen or exec which others have suggested -
apparently, students aren't supposed to move outside of the box.
Obviously, what I need is a genuwine C++ book from a non-college
bookstore. However, even though those don't cost as much as the ripoff
price of textbooks, they still are not cheap, studentwise. Maybe I can
code some rich kids homework for the price:-)
Thanks
Hagar (but not too horrible).
Hagar wrote: But I don't find anything (or maybe don't recognize it) in my manuals - calling, external calls, external functions, system, system Thanks guys. Interestingly, system is what perl uses to call outside the main code. But... There is not a single reference to the system command in either of my C++ books, or popen or exec which others have suggested - apparently, students aren't supposed to move outside of the box.
Obviously, what I need is a genuwine C++ book from a non-college bookstore. However, even though those don't cost as much as the ripoff price of textbooks, they still are not cheap, studentwise. Maybe I can code some rich kids homework for the price:-)
No. popen() and exec() won't be in any book describing C++, as they
aren't part of the Standard. They would be in a book describing "C++
Programming in a [YOUR_OS_HERE] Environment".
I don't recall whether system() is part of the Standard either, but it
would be described in the second type of book ("C++ for XXX Environment").
Hagar wrote: Thanks guys. Interestingly, system is what perl uses to call outside the main code. But... There is not a single reference to the system command in either of my C++ books,
That's a failing.
or popen or exec which others have suggested -
There are no such things in C++. Some implementations have extensions by
these names, but unless your book specificially covers that platform, it
would not be unusual for it not to mention them. You don't mention which
books you are using.
apparently, students aren't supposed to move outside of the box.
I don't understand this statement.
Obviously, what I need is a genuwine C++ book from a non-college bookstore. However, even though those don't cost as much as the ripoff price of textbooks, they still are not cheap, studentwise. Maybe I can code some rich kids homework for the price:-)
Check your local public library, it may have useful books.
Brian Rodenborn
red floyd wrote: I don't recall whether system() is part of the Standard either, but it would be described in the second type of book ("C++ for XXX Environment").
Yes, it is.
Brian Rodenborn
> Thanks guys. Interestingly, system is what perl uses to call outside the main code. But... There is not a single reference to the system command in either of my C++ books, That's a failing.
As my instructor says, textbooks are to make publishers money - they have
nothing to do with teaching or learning - unfortunately, they are also
mandated by the state based on the amount of donations received by
politicians from publishers.
n't supposed to move outside of the box. I don't understand this statement.
Just some minor sarcasm.
Check your local public library, it may have useful books.
Brian - You are not from East Texas, are you? In our only public library
there are books about the latest advances in V2 rocketry, history books
that speculate on what the world will be like after WWII ends, the latest
research on vacuum tube radios, and info on something called a wire
recorder that actually records voices.
Oh yes. There is also a programming book. It is about Autocoder
that runs on an IBM 1401 ??? (whatever the heck that is).
I think I better wait till I have the money to visit a real Dallas book
store.
Hagar
Hagar wrote: Check your local public library, it may have useful books.
Brian - You are not from East Texas, are you?
No.
Oh yes. There is also a programming book. It is about Autocoder that runs on an IBM 1401 ??? (whatever the heck that is).
Almost any library can get books via inter-library loan.
Brian Rodenborn This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dariusz |
last post by:
I currently have a layout that is part written in SHTML - in other words,
it gets processed by the web server to execute any calls for PHP or Perl
code as well as the html (and external imported HTML) in the page that is
in the SHTML page.
What I would like to do is convert this SHTML into PHP generated code so I
can drastically cut the amount of code duplication I currently have per
page, and make it easier to roll out changes - same...
|
by: Linus Nikander |
last post by:
After trying to manually reverse-engineer a piece of code i've been handed
using Visio I figure someone must have developed a tool that can do
automatically in 5 minutes what took me 2 hours.
What I need is a tool that i can tell to "start with this method call, and
show me what happens" . The tool would then go through the sourcecode
visually mapping dependencies for that particular call. Prefrebly i'd be
allowed to specify which calls...
|
by: Juan Manuel Alegría B. |
last post by:
Hi group I have been making a windows service to execute an external
application. I use a timer control, I can execute the application but
does't appear as a normal windows, just I see it in the windows task manager
as a
local service. I think it must appear as a normal process. Someone
knows about it or has any idea?
Juan Manuel Alegria B.
Jalisco, México.
|
by: Scott Allen |
last post by:
Hello,
I'm new to C++ development and I'm trying out figure out the cause of
an 'unresolved external symbol' error that I'm receiving when
compiling. Here is some history on what I'm doing:
I have an existing VC++ project that mostly just reads a SQL Server
database does some work on the data and insert the results into
another table. I have the need to incorproate some functionality from
a certain dll named cedb300.dll. cedb300.dll...
|
by: Richard Hayden |
last post by:
Hi,
I have the following code:
/******************************** file1.c
#include <iostream>
extern void dummy();
inline int testfunc() {
| |
by: stevo |
last post by:
What causes C# to generate code to call the same external DLL 2
different ways?
At one point in the app, it calls the entry point like this
(disassembled) and it bombs with a null reference:
00000064 call dword ptr ds:
At another point in the same app, it calls the exact same entry point
like this and it works:
00000051 call 00A5B073
|
by: zxcv |
last post by:
I have inherited an app that is using java to generate images that it
loads into a PDF via external-graphic in XSL-FO. The problem I have is
that my architecture environment is going to require in a few months
that all calls made from my app be done via HTTPS. Currently the app
makes these image source calls via HTTP. However, it seems to me that
FOP is incapable of issuing these HTTPS requests. The code never gets
called, while as a...
|
by: Maydogg6 |
last post by:
I need a hand with some stubborn link errors.
I'm trying to recreate and old program from 6.0 into .NET, but for some reason when I try to compile I'm getting linking errors for all my function calls that deal with sockets. I've included <winsock2.h> in stdafx.h and I linked to ws2_32.lib by going to project properties->linker->general->additional library directories and typing in ws2_32.lib.
Am I missing some include files or have the...
|
by: pompeyoc |
last post by:
Hi. I was wondering if anyone out here knows if there is a limit to
the size of an external stored procedure? I am currently using VB
programs in Windows to call small COBOL stored procs residing in AIX
without any problems. This time, however, I am planning to have
another VB program call a COBOL stored proc that, in turn, calls other
COBOL programs via ordinary COBOL CALLs.
Any ideas?
|
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...
|
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,...
| |
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |