i cant understand diff b/w open and fopen .
please analysie below programs
Code:#include<stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { int f; char ch; f=open("/root/cprograms/file.txt",O_RDWR,0777); while(ch !='n') { ch=getc(f); printf("%c",ch); i++; } printf("\n"); return 0; }
Code:#include<stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main() { FILE *fd; char ch; fd=open("/root/cprograms/file.txt",O_RDWR,0777); while(ch !='n') { ch=getc(f); printf("%c",ch); i++; } printf("\n"); return 0; }
ouput i want to get as text in file.txt
any body can help me?



LinkBack URL
About LinkBacks


