i have ten program in C, and there are functions what are in all the programs.
so, i want to make a directory to store all the functions what are in all the programs, and call them from the C programs. (sending variables and values)
is that possible?¿? how ca i do that?¿?
any idea, thanks
You are saying that you have the same identical functions repeated.
move a copy of all of those functions into a separate file, like myfunctions.c
Be sure to add all of the headers (#include <> and #include "") statements you need.
Next be sure the ten source code files have the functions declared as prototypes
eg., int myfoo( char *, int); or whatever. The easy and best way is to put these prototypes in an .h file
-- let's call it myfunctions.h
In each of the ten source code files be sure to have:
in all ten files near the top.
Strip the repeated functions out of the ten source code files.
You now have choices about how you get the ten files to use the functions. One choice is to compile myfunctions.c into an object file:
this creates myfunctions.o
Then compile each of the ten source code files like this-- with myfunctions.o and myfunctions.h in the current working directory:
i have a file that contains functions and i want the functions to be available in another script.
of course, the ideal situation here would be to put the functions in the same script, but i dont own these scripts. so I have to call the functions file from a different script.
how do i... (3 Replies)
Hi,
I am creating a script that does gunzip/unzip/untar depending on the file extension.
I have created 3 functions in my script and call them in following order.
1) gunzip function
2) unzip function
3) untar function
I am using FILENAME=${FILENAME%.*} to modify filename between... (2 Replies)
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Hi Team,
I have four shell scripts and i need to put it into one script and call based on requirement.
For example:
If server is Linux and version of my software version is 5 then it should call 1st scipt
If server is Solaris and version of my software version is 6 then it should call... (16 Replies)
Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right... (1 Reply)
Hi all,
I just started working on kernel modules. One query i'm not able to resolve how i can use call any of my function(take example testfunc() ) defined in my loadable kernel module (take example : test.ko)
I want to export kernel module functions to user programs.
Consider i have... (0 Replies)
Hi,
i want to call two programs simultaneously from a currently running program so as to distribute the job and fasten the speed.
As of now I call the programs one after the other within the main program.
e.g.
`perl A.pl`;
`perl B.pl`;
how can I run the two paralelly?
urgent ... please... (1 Reply)
Hi,
I am a beginner in Perl programming. Now i need to call a C program from a perl program ...Can any one please help me and give any details how i can do this.
Thanks and Regards (3 Replies)