Wednesday, January 7, 2015
in nội dung file lên màn hình
//in nội dung file lên màn hình
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
FILE *t;
char s[100];
t=fopen("E:\\text.txt","r");
if(t==NULL)
{
printf("khong mo duoc\n");
exit(0);//ket thuc chuong trinh
}
fgets(s,100,t);
puts(s);
fclose(t);
}
Related Posts:
ghi chuổi lên file đến khi chuổi nhập vào là rỗng thì kết thúc //ghi chuổi lên file đến khi chuổi nhập vào là rỗng thì kết thúc #include<stdio.h> #include<stdlib.h> #include<string.h> void main() { FILE *t; char s[100]; t=fopen("E:\\toan.txt","w"); if(t==NULL) { … Read More
in nội dung tạp tin ra màn hình //in nội dung tạp tin ra màn hình #include<stdio.h> void main() { FILE *t; char s[100],c; printf("nhap file:"); gets(s); t=fopen(s,"r"); if(t==NULL) printf("error"); else { while((c=getc(t))!=… Read More
đếm số ký tự trong 1 file văn bản //đếm kí tự trong file,đếm số ký tự trong 1 file văn bản #include<stdio.h> #include<conio.h> int dem(FILE *t) { int dem=0; char c; while(c=getc(t)!=EOF) dem++; return dem; } void main() { FILE *t; t=fopen… Read More
nhập 10 số thực vào một file văn bản có tên là input. /*bài 1.*/ // viết chương trình thực hiện các yêu cầu: //• nhập 10 số thực vào một file văn bản có tên là input. //• đọc nội dung file input. //• tính tổng bình phương các số có trong file in… Read More
chương trình c đếm số từ trong file //chương trình đếm số từ trong file #include<stdio.h> #include<stdlib.h> void main() { FILE *t; int k=0,dem=0; t=fopen("E:\\toan.txt","r"); if(t==NULL) { printf("error"); exit(0); } char c; do { c… Read More