Jayster2
Gebruiker
- Lid geworden
- 3 nov 2008
- Berichten
- 39
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main ( int argc, char *argv[] ) {
if ( argc != 3 ) {
cout << "Usage:" << argv[0] << " [password] [videoid]\n";
}
else {
if ( argv[1] == "test" ) {
ofstream html;
cout << "Opening file";
html.open ("example.html");
html << "test " << argv[2] << " test";
cout << "Done writing to file";
}
else {
cout << "Wrong Password...\n";
cout << "Usage:" << argv[0] << " [password] [videoid]\n";
}
}
return 0;
}
x.c: In function ‘int main(int, char**)’:
x.c:10: warning: comparison with string literal results in unspecified behaviour
Waarom werkt dit niet ? hij heeft hier moeite mee volgens mij: if ( argv[1] == "test" ) {
Groetjes