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

**URL:** <https://community.unix.com/t/help-in-passing-array-of-inputs-to-c-program-using-script/189721>\
**Category:** Shell Programming and Scripting\
**Created:** [March 20, 2008, 3:55am UTC](https://community.unix.com/t/help-in-passing-array-of-inputs-to-c-program-using-script/189721 "2008-03-20T03:55:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahjiefreak](https://community.unix.com/letter_avatar/ahjiefreak/32/6_22734026db12803ebb3e059622ac3534.png) [@ahjiefreak](https://community.unix.com/u/ahjiefreak)\
**Post date:** [March 20, 2008, 3:55am UTC](https://community.unix.com/t/help-in-passing-array-of-inputs-to-c-program-using-script/189721/1 "2008-03-20T03:55:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Franklin52](https://community.unix.com/user_avatar/community.unix.com/franklin52/32/500_2.png) [@Franklin52](https://community.unix.com/u/Franklin52)\
**Post date:** [March 20, 2008, 7:36am UTC](https://community.unix.com/t/help-in-passing-array-of-inputs-to-c-program-using-script/189721/2 "2008-03-20T07:36:22Z")

</div>

What is the reason to use sed? In C you can use fpopen() and fgets() to read the file.

Regards
