English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

4 answers

Hi,
As u r using text file, therefore file has been opened in text mode. This programme doesnt read/write file from any directory, but it uses C:\tc\bin as target directory.

#include
#include

void main()
{
char c;
FILE *fp,*fpd;
fp=fopen("abc.txt","r"); //Source file
fpd=fopen("abc1.txt","w"); //Destination file
clrscr();
while(!feof(fp))
{
c=fgetc(fp); //reading character from source file one-by-one
fputc(c,fpd);//writing character to destination file one-by-one
}
fclose(fp);//closing source file
fclose(fpd);//closing destination file
getch();
}

2007-09-05 00:54:16 · answer #1 · answered by iqbal 4 · 0 0

easier way would be using command line rather than streamming the entire file.

2007-09-05 19:33:39 · answer #2 · answered by i_am_the_next_best_one 5 · 0 0

difficulty! String languages have been invented in 1962. In 1967, SNOBOL4 become released. right it is this technique in SNOBOL4 (acquire csnobol4 to run this) ....vowels = 'a' | 'e' | 'i' | 'o' | 'u' ....&anchor = a million precise l = enter :f(end) ....l vowels :f(precise) ....output = l :(precise) end replace optimum .... with 4 areas.

2016-11-14 06:01:27 · answer #3 · answered by ? 4 · 0 0

#include
#define MAX_BUFF 1024

int main(int argc,char** argv)
{
FILE *ips,*ops;
char buff[MAX_BUFF];
size_t read;

if((ips = fopen("input","rb"))==NULL)
return 0;
if((ops = fopen("output","wb"))==NULL)
return 0;
while(!feof(ips))
{
read = fread(buff,MAX_BUFF,1,ips);
fwrite(buff,read,1,ops);
}
fclose (ips);fclose(ops)
return 0;
}

NOTE: this should compile by GCC. Can obtain this by using Dev-C++ under windows. Obviously if you write it under *nix system, will work straight out of the box.

2007-09-05 01:05:15 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers