Code: Show/Hide msg = "Operators: ";
GetPrivateProfileSection("Operators",buffer,250,path); String opstr = buffer; GetPrivateProfileString("Operators","ASOCount",0,question_num,3,path); for (int i = 1;i <= atoi(question_num);i++) { msg += opstr.split('\n'); msg += ", "; } sendPrivate(p,msg); |
Code: Show/Hide char *p;
p = buffer; // loaded with results of function call while (*p) { // set your string = p and do what you like p += strlen(p) + 1; } |
Mr Ekted wrote: |
This shows C's strength: the ability to handle memory in an arbitrary format. |
Dark_Nexus wrote: |
the way it returns the section is, each data key gets put into the buffer as a string, it is followed by a NULL terminating character, and the last string of the buffer has two NULL terminating characters. So it looks like this in the buffer: Dark_Nexus=3 \n blehbleh=4 \n bleep=2 \n\n |
Code: Show/Hide ifstream op_file;
char buffer[100], ops[20][12], levels[20]; for (int i = 0; i < 20; i++) { if (op_file.eof()) break; op_file.getline(buffer, 100); int loc = find(bufffer, '='); //some kind of character finding func strncpy(ops[i], buffer, loc); levels[i] = atoi(buffer + loc + 1); } |
Dark_Nexus wrote: |
GetPrivateProfileSection is a standard windows function...i would hope it was microsoft tested and approved ![]() |