Step 1: First of all you need to install GCC compiler to compile a C or C++ program.
Step 2: Write the bellow program to display any type of file in the Command Prompt.
Step 3: Write the program and save as name, read.c
Step 4: Compile the program by following process derive in step-5 .
Step 5: C:\Users\Admin\Desktop\C_Program> gcc read.c -o read
Step 6: After this you can see a file named read.exe has been created in that directory.
Step 7: After doing this create a text file, ass like "ltter.txt" .
Step 8: Type the below command derived in step 9.
Step 9: C:\Users\Admin\Desktop\C_Program> read letter.txt
The Program
#include "fcntl.h"
#include "stdio.h"
main(int argc, char *argv[], char *env[])
{
int i;
char ch;
for(i=1; i<argc;i++)
{
int k=open(argv[i], O_RDONLY);
while(read(k, &ch, 1))
{
printf("%c", ch);
}
close(k);
}
}
The Out Put Will Be.
0 Comments