cin>>manip

Hello!
I need to create a function - input stream manipulator(with arguments). I managed to create the function, but how can i make it work like this:
1
2
3
4
 int s=0;
 cin>>manip(agr)>>s
 //or just
 manip(arg)<<s

for example...
Thank you !
And it must have one argument!
any idea will be of help
I think you have to create a small class for this
1
2
3
4
5
6
7
8
9
10
11
12
struct manip
{
	manip(argument)
	{
		//Your function
	}
};

istream& operator >> (istream& is, manip mymanip )
{
	return is;
}
Hello!
I want to redirect cin to another input element.To be more specific....I use cin to take input to my program.But I dont want to take it from the keyboard but from a specific .txt file.What are the possible ways.Through console(on a windows os system),through my IDE(i use codeblocks if it helps) or something else?
I am looking forward to your proposes.
Thanks in advance!

EDIT:I use gcc compiler.
Last edited on
Why don't you simply use an ifstream?
If forced to do it this way;)
% ./a.out < myfile.txt
Last edited on
I don't think you are allowed of changing streams destinations
ok guyz thanks for the answer.i solved my problem
Topic archived. No new replies allowed.