Taking and skipping chars from files
What I'm trying to do it open up a large text file, and remake it elsewhere without spaces, but I'm only getting a fraction of my file. Here's my code :
Code:
#include <iostream.h>
#include <fstream.h>
#include <ctype.h>
ifstream fin;
ofstream fout;
char cont[10001000];
int main()
{
fin.open("C:\\windows\\system32\\shell32.dll", ios::nocreate | ios::in);
fout.open("hello.txt", ios::out);
for(long i = 0; i < 10000000; i++)
{
fin.get(cont[i]);
while(isalnum(cont[i]))
{
fout << cont[i];
i++;
}
}
return 0;
}
I'm looping until one million, but I want to know if I can use something like fin.EOF and what's its syntax ? Then, of course, why do I only get 220 bytes from a 12.5 megabyte file ? There are much more alphanumerical characters in it than I'm getting.
Thanks for any help.