Help in passing array of inputs to C program using script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in passing array of inputs to C program using script?
# 1  
Old 03-20-2008
Help in passing array of inputs to C program using script?

Hi,

I have a file input which has 1000 data inputs of array elements.

I would like to pass this to a C program one line at a time as input automatically. Anyone know how I could use "sed" to perform this?


Appreciate alot. Thanks.
# 2  
Old 03-20-2008
What is the reason to use sed? In C you can use fpopen() and fgets() to read the file.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing arguments to interactive program through bash script, here document

Dear Users, I have installed a standalone program to do multiple sequence alignment which takes user parameters to run the program. I have multiple sequence files and want to automate this process through a bash script. I have tried to write a small bash code but its throwing errors. Kindly... (13 Replies)
Discussion started by: biochemist
13 Replies

2. Programming

Passing argument to a program!!

Hi friends, I have a small query, hope u will help me with it. I want to write a small program which would take an integer as an argument, then I want to save that argument in a variable of type int. Could you please help me with it. Here is my program #include <stdio.h> int main(int... (4 Replies)
Discussion started by: gabam
4 Replies

3. Shell Programming and Scripting

Passing screen value to a program

Hi all, I have the following question. Apparently not very difficult, but I'm not any expert. I have a program, let's say program.x, and a bash script that execute it, let's say program.sh. When the program executes it asks for a value to continue. What I want is just passing the value throw... (2 Replies)
Discussion started by: josegr
2 Replies

4. Shell Programming and Scripting

Passing array to functions in ksh script

Let me know if there is a way to pass array to a funtion in ksh script. function isPresent { typeset member member=$1 dbList=$2 echo '$1:' $1 echo '$2' $dbList The array will be at the second position....something like this isPresent 12 <array> if then echo... (3 Replies)
Discussion started by: prasperl
3 Replies

5. Shell Programming and Scripting

Can we pass an array of strings from a Perl Program to a Shell Script?

Hi Folks, The subject is my question: Can we pass an array of strings from a Perl Program to a Shell Script? Please provide some sample code. Thanks ---------- Post updated at 11:52 PM ---------- Previous update was at 11:43 PM ---------- I got it. Its here:... (0 Replies)
Discussion started by: som.nitk
0 Replies

6. Shell Programming and Scripting

passing line into array

I am doing a shell script in ksh. I have an output from grep that goes something like this: wordIWasLookingFor anotherWordIWasLookingFor yetAnotherWordIWasLookingFor I want to toss each line into an array such that: myArray = wordIWasLookingFor myArray = anotherWordIWasLookingFor... (3 Replies)
Discussion started by: mrwatkin
3 Replies

7. Shell Programming and Scripting

passing argument to shell script that reads user inputs

Hi, Lets say I have a script "ss" which does this read abc echo $abc read pqr echo $pqr Now if I want to pass and argument to only "abc" how do I do it. If I do echo "somevalue" | ss, it does not prompt for pqr and its value comes out as blank. Any help is appreciated Thanks P (6 Replies)
Discussion started by: patjones
6 Replies

8. Shell Programming and Scripting

Passing a file handler and an array from Perl to Shell Script

Hi there, I am trying to call a shell script from a Perl script. here is the code: @args = ("sh", "someshellprg.sh", "a file handler", "an array"); system(@args) == 0 or die "system @args failed: $?"; in the shell program, I examine if the arguments exits using: if then echo... (5 Replies)
Discussion started by: pinkgladiator
5 Replies

9. Programming

Passing by value a char array

Hi I am passing or want to pass value of a char array, so that even thoug the called routine is changing the values the calling function should not see the values changed, meaning only copy should be passed Here is the program #include<iostream.h> #include<string.h> void f(char a); int... (5 Replies)
Discussion started by: rkraj
5 Replies

10. Programming

Passing Parameters and getting values back from a c program to Shell script

I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that? eg: int main() { char st1; char str2; // call a shell script call_sh(str1,str2) where call_sh is the name of the shell script. then i need to get the return... (5 Replies)
Discussion started by: Rajeshsu
5 Replies
Login or Register to Ask a Question