how can i read character by character from a text file
using isrteam.

i use :
istream s;
char *next;
next=new char;
s.open("example.txt");
s.read(next,1);

but this gives me each character with some dummy symbol.

Recommended Answers

All 2 Replies

char ch = 0;
//read file character by character
while(file && file.get(ch) ){
 cout << ch;
}

but what is problem in my code?
i saw it on net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.