Could anyone help me with a code where you can choose to read a special amount of characters in a file (from the beginning and forward), and then output the characters to the screen?
Could anyone help me with a code where you can choose to read a special amount of characters in a file (from the beginning and forward), and then output the characters to the screen?
do something like this
ifstream fin;
char data;
int n;
for(i=1;i<=n;i++)
{
fin>>data;
cout<<data;
}
-
I think that it would be better to take the whole file content, and put it in a char array buffer..
Then you can search the array, as you like, may be something like this:
const int tb_size = 10000;
char textBuffer[tb_size];
int i = 0;
int count = 9;
for (i = 0;i < count && textBuffer[i] != '\0';i++)
{
cout << textBuffer[i] << endl;
}
this would print 10 chars