0

Im new. I want to address a character in a .txt file as I would do in an array like this:

int a[100];
for(i=0; i<100; i++) {
   a[i]=x;
//or
   cin >> a[i];
//or
   cout >> a[i];
}

can I use this method to the .txt file? if I can do this with pointers, how?

1 Answers1

-1

As mentioned in comments you can read the contents of that .txt file into a char array, and then work on that array data.

This answer How to copy a .txt file to a char array in c++ should show you how to do this.

Kieran
  • 214
  • 1
  • 6