I have written two simple C programs, program1 prints out a predefined string and program2 takes a string as an argument and writes that string into a file.
What I'm trying to do is to take the output of program1 and pass it to program2. I've been through bash tutorials and the only solution I could find was:
program1 | program2
This is supposed to work but I get a segmantation fault. So I tried this and it works.
program1 | program2 abc
As you can guess this results in an output file containing the string "abc". program1 | program2 seems straightforward but I guess I'm missing something here?