i know the total no of characters in an input file and have make an array of that size.i want to know how can i get all the elements of the file in the array?
i know the total no of characters in an input file and have make an array of that size.i want to know how can i get all the elements of the file in the array?
once a kohatian,always a kohatian!
Use a for loop and get each individual char inside it.
Code:#define size 100//or whatever the size is int counter; char array[size]; ifstream infile("file.txt"); for(counter=0;counter<size;counter++) array [counter]=infile.get();
Hi!
For file i/o information, check out the best tutorial on this topic:
http://www.cpp-home.com/FileIO_tutorial.php
Ilia Yordanov,
http://www.cpp-home.com ; C++ Resources