Intel® SoC FPGA Embedded Development Suite
Support for SoC FPGA Software Development, SoC FPGA HPS Architecture, HPS SoC Boot and Configuration, Operating Systems
446 Discussions

Running binary file in Linux "with inputs"

jlats2
New Contributor I
888 Views

Hello,

 

So I am new to linux and binary files so please bare with me and feel free to correct me for my horrid use of terminology.

So I have a main.c file which I am able to make into a binary file and execute it on linux command line (i.e. chmod 777 my_binary and then ./my_binary).

 

1) Is it possible for me to provide an input to my binary similar to a function call. For example could I call: ./my_binary -Input1 -Input2 -Input3 where the inputs (Input1, Input2 and Input3) to my program (what is this process called)?

 

2) Do you know of any tutorials going over this? Or would you be kind enough to provide a demonstration?

 

3) What would I need to do to my main.c file in order to properly receive these inputs (I am imagining that this would be similar to a C function, right)?

 

Thank you for your help.

0 Kudos
1 Reply
AnilErinch_A_Intel
858 Views

Hi

You can use the argv and argc as arguments to your main function then achieve the expected behavior.

Please see the external link below for some step by step example.

https://www.thegeekstuff.com/2013/01/c-argc-argv/

Thanks and Regards

Anil

 

0 Kudos
Reply