Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- Rashmi singhParticipant
Reply: C program to display own source code as output
a simple way of doing this is Using “SYSTEM CALLS”
1234main()<br />{<br />system("type filename.c");<br />}Rashmi singhParticipant12345678910111213#include<stdio.h><br />main()<br />{<br />FILE *fp;<br />char ch;<br />fp=fopen("file_display.c","r"); //here 'file_display.c' may differ<br />//reads char by char and stores it in 'ch' until the End of File<br />while((ch=getc(fp))!=EOF)<br />{<br />putchar(ch);<br />}<br />fclose(fp);<br />} - AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)