Functions with bool parameter

Hi,

I have this function:

1
2
3
4
5
6
7
8
9
10
11
12
13
String^ Column0(string pathname){
	String^ str1;
	ifstream fin(pathname);
	{							
	string str;
	while (getline(fin, str)){
		if (myBool(str))
			str1 = gcnew String(str.substr(5).c_str());	 
			}
	}
	fin.close();
	return str1;
}


I am unsure how to add a bool parameter to this function; myBool needs to be the second parameter. I have tried the following for line 1 by I get errors:

String^ Column0(string pathname, bool myBool){....

What do I need to do?

Cheers,
Last edited on
Ha!

Nevermind. I solved it... Well this code works anyway:

1
2
3
4
5
6
7
8
9
10
11
12
13
String^ Column0(string pathname, bool myBool(const std::string & str)){
	String^ str1;
	ifstream fin(pathname);
	{							
	string str;
	while (getline(fin, str)){
		if (myBool(str))
			str1 = gcnew String(str.substr(5).c_str());	 
			}
	}
	fin.close();
	return str1;
}
Last edited on
Topic archived. No new replies allowed.