Quote: |
DefaultLevelFile=m |
Code: Show/Hide #include <windows.h>
#include <stdlib.h> #include <iostream> using namespace std; void c() { system("cls"); } void p() { system("pause"); } void writeINI(char *section, char *key, char *writeThis, char *path) { WritePrivateProfileStringA(section,key,writeThis,path); } void visual() { SetConsoleTitle("Quick Server Set Up"); system("color f0"); c(); } void load(char *fileName) { CopyFile(fileName,"c:\\windows\\A3_Config.ini",false); } void save(char *fileName) { CopyFile("c:\\windows\\A3_Config.ini",fileName,false); } void config(string name, string hint, char *section, char *key) { c(); cout<<"\n\n\n\n\n\t\t\t["<<name<<" configuration]"; cout<<"\n\n\n\n\n\nAbout:\t"<<hint<<"\n\n\n\n\n\t\t\tEnter: "; char value; cin>>value; writeINI(section,key,&value,"A3_Config.ini"); } int main() { visual(); load("server.ini"); p(); config("DefaultLevelFile","DefaultLevelFile is the map that player will see when entering \n\tyour zone, below enter the name of the map file...","Misc","DefaultLevelFile"); save("server.ini"); } |
Code: Show/Hide void writeINI(char *section, char *key, char *writeThis, char *path)
{ WritePrivateProfileStringA(section,key,writeThis,path); } char value; cin>>value; writeINI(section,key,&value,"A3_Config.ini"); |
Code: Show/Hide error: invalid conversion from `char' to `char*' |
Code: Show/Hide cannot convert `char (*)[80]' to `char* |
Code: Show/Hide char value[80];
cin>>value; |
Code: Show/Hide value[79]='\0'; |
Code: Show/Hide #include <string>
#include <iostream> using namespace std; int main() { string name; cout << "enter name: "; cin >> name; cout << "you entered " << name.c_str() << endl; return 0; } |
Code: Show/Hide WritePrivateProfileStringA(section,key,writeThis,path); |
hellzlaker wrote: |
um this is not what i was trying to do bak |
Code: Show/Hide cannot convert `char (*)[80]' to `char* |
Code: Show/Hide string value;
cin>>value; writeINI(section,key,value.c_str(),"A3_Config.ini"); |
Code: Show/Hide error: invalid conversion from `const char*' to `char*' |
Code: Show/Hide writeINI(section, key, const_cast<char *>(value.c_str()), "A3_Config.ini"); |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | |
You have to cast the "const char *" into a "char *"
In C, you would have simply used (char *) to cast it, but above is the C++ way. |
Code: Show/Hide void writeINI(const char *section, const char *key, const char *writeThis, const char *path)
{ WritePrivateProfileStringA(section,key,writeThis,path); } |