D
Daniel Fudge
I can't send a string from a dymanic array to a function.
At the getpts function declarationon (line 14), I get the following
error.
"main.cpp(14) : error C2664: 'void __thiscall
std::basic_ifstream<char,struct std::char_traits<char> >:pen(const
char *,int)' : cannot convert parameter 1 from 'class
std::basic_string<
char,struct std::char_traits<char>,class std::allocator<char> >' to
'const char *'
No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called"
I have something like:
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
main() {
int n = 2;
std::string *filenames = new std::string[ns];
filenames[0] = "name1";
filenames[1] = "name2";
getpts(filenames);
delete[] filenames;
}
void getpts(std::string *filenames) {
cout << filenames[0];
}
Any help would be greatly appreciated.
At the getpts function declarationon (line 14), I get the following
error.
"main.cpp(14) : error C2664: 'void __thiscall
std::basic_ifstream<char,struct std::char_traits<char> >:pen(const
char *,int)' : cannot convert parameter 1 from 'class
std::basic_string<
char,struct std::char_traits<char>,class std::allocator<char> >' to
'const char *'
No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called"
I have something like:
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
main() {
int n = 2;
std::string *filenames = new std::string[ns];
filenames[0] = "name1";
filenames[1] = "name2";
getpts(filenames);
delete[] filenames;
}
void getpts(std::string *filenames) {
cout << filenames[0];
}
Any help would be greatly appreciated.