So I call argv[] in my main to take in input from the terminal but I can't seem to pass it to another function correctly.
For my main function I have:
1 2 3 4 5 6 7 8
|
int main(int argc, char *argv[]){
// if(argc == 1){}
// if(argc == 2){
readInFile(argc, argv[]);
// }
}
|
for my function I have the call as:
|
void readInFile(int argc, char *argv[]){
|
the errors I am getting are:
lab06.cpp: In function ‘void readInFile(int, char**)’:
lab06.cpp:22:35: error: invalid user-defined conversion from ‘std::basic_istream<char>’ to ‘const char*’ [-fpermissive]
printw(getline(myfile, line));
^
In file included from /usr/include/c++/4.8.2/ios:44:0,
from /usr/include/c++/4.8.2/ostream:38,
from /usr/include/c++/4.8.2/iostream:39,
from lab06.cpp:4:
/usr/include/c++/4.8.2/bits/basic_ios.h:115:7: note: candidate is: std::basic_ios<_CharT, _Traits>::operator void*() const [with _CharT = char; _Traits = std::char_traits<char>] <near match>
operator void*() const
^
/usr/include/c++/4.8.2/bits/basic_ios.h:115:7: note: no known conversion for implicit ‘this’ parameter from ‘void*’ to ‘const char*’
lab06.cpp: In function ‘int main(int, char**)’:
lab06.cpp:32:27: error: expected primary-expression before ‘]’ token
readInFile(argc, argv[]);