Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 770  / 2 Years ago, sun, september 4, 2022, 6:50:28

I created a simple C program which prints "Hello world" as output and saved it as test.c.



Compiled it in terminal as gcc -o test test.c & run it as ./test but the there is no output showing.



If the same program saved as try.c and any(but not as test) it compiles & runs perfectly.



Why? Is there a problem with a compiled C binary having the name test?


More From » gcc

 Answers
1

there is a bash program called test and when run it does nothing without arguments (do a quick man test in terminal to see more about it). That is why renaming worked :)



Lots of people do not know 'test' is a program too, best not to name scripts and such 'test'


[#23056] Monday, September 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
percol

Total Points: 493
Total Questions: 116
Total Answers: 107

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;