: : : : : :
: : : : : : Can you please tell me how to read the files to a string? I can't
: : : : : : seem to manage it!
: : : : : :
: : : : :
: : : : :
: : : : : post your code. It should go something like this
: : : : :
: : : : :
: : : : : char iobuf[255];
: : : : : FILE* fp = fopen("filename.txt","r");
: : : : : if( fp != NULL)
: : : : : {
: : : : : while( fgets(iobuf,sizeof(iobuf),fp) )
: : : : : {
: : : : : // do something here
: : : : : }
: : : : : fclose(fp);
: : : : : }
: : : : : : : : : :
: : : : :
: : : : : =============================================
: : : : : never lie -- the government doesn't like the competition. (Author
: : : : : unknown)
: : : :
: : : :
: : : :
: : : :
#include <stdio.h>
: : : :
: : : : FILE* fin1;
: : : : FILE* fin2;
: : : : char buf1[500], buf2[500];
: : : : char arr1[500];
: : : : int i;
: : : :
: : : : main()
: : : : {
: : : :
: : : : fin1= fopen("c:\\b.txt","r");
: : : : fin2=fopen("c:\\c.txt","r");
: : : : if (fin1!=NULL)
: : : : {
: : : : while (fgets(buf1,sizeof(buf1),fin1) )
: : : :
: : : : { arr1[i]=buf1[i];
: : : :
: : : : i++;}
: : : : fclose(fin1);
: : : : }
: : : :
: : : : }
: : : :
: : : :
But it doesn't work this way?Pleazzz!What am id
: : : : doing wrong?
: : : :
: : : You're not searching through the text file or saving the resulting
: : : array.
: : :
: : How do I do that Please?
: :
: You can put stuff onto a file using
:
f
: puts.
: As for searching it, the first step is to find all the words that
: are being searched for, and store them in an array of strings. Then,
: somehow actually look through the buffer for the words, and add the
: findings to file C.
:
As for searching it, the first step is to find all the words that
: are being searched for,
and store them in an array of strings. Then,
: somehow actually look through the buffer for the words, and add the
: findings to file C.
I have understood that!!!I don't know how to store them in an array.That is the problem!! Thank you in advance once again!