given file a.txt how can I pass the content of this file as arguments to the main function ?
for example:
a.txt:
a b c d e
and the main function is:
int main(int argc, char *argv[]);
And I want to pass the content of this a.txt file as arguments to main function. Namely, the arguments will be: a b c d e.
How can I do it via Eclipse compiler ?
In Eclipse, you can configure parameters for running your code in the IDE... https://www.tutorialspoint.com/eclipse/eclipse_run_configuration.htm
But programatically you will need a script that reads the contents of the file and constructs the command-line that invokes main() with those file contents as command-line parameters.
Or for an elegant one-liner, see this answer by David Ranieri... https://stackoverflow.com/a/73736630/20006834