How can we write a c/c++ program that displays it's own code? I tried
the following logic in the code...

first, i opened the file using open(argv[0]) in read mode. then, i got
all the characters in it using get() function, assigned it to a
character and displayed the same using cout and iterating the process
till eof condition is reached. but the output is not the program code,
but a set of weird symbols. 

Pls tell me wats wrong with this logic? and what has gone wrong there?

Reply via email to