Werbeanzeige
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Liest einen String aus der INI-Datei tbResult tbReadINIString(char* pcSection, char* pcKey, char* pcOut, int iBufferSize, LPCSTR cFile); // Liest einen int-Wert aus der INI-Datei int tbReadINIInt(char* pcSection, char* pcKey, LPCSTR cFile); // Liest einen float-Wert aus der INI-Datei float tbReadINIFloat(char* pcSection, char* pcKey, LPCSTR cFile); // Liest einen tbVector3-Wert aus der INI-Datei tbVector3 tbReadINIVector3(char* pcSection, char* pcKey, LPCSTR cFile); // Liest einen tbColor-Wert aus der INI-Datei tbColor tbReadINIColor(char* pcSection, char* pcKey, LPCSTR cFile); // Dieser Code bereitet über 100 Fehler in der Datei "tbColor.h" |
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
// Liest einen int-Wert aus der INI-Datei int tbReadINIInt(char* pcSection, char* pcKey, LPCSTR cFile) { char acString[256]; // String lesen tbReadINIString(pcSection, pcKey, acString, 256, cFile); if (!strcmp(acString, "[NOT FOUND]")) return 0; // In int-Wert umwandeln return atoi(acString); } // __________________________________________________________________ // Liest einen float-Wert aus der INI-Datei float tbReadINIFloat(char* pcSection, char* pcKey, LPCSTR cFile) { char acString[256]; float fValue; // String lesen tbReadINIString(pcSection, pcKey, acString, 256, cFile); if (!strcmp(acString, "[NOT FOUND]")) return 0.0f; // In float-Wert umwandeln sscanf(acString, "%f", &fValue); return fValue; } // __________________________________________________________________ // Liest einen tbVector3-Wert aus der INI-Datei tbVector3 tbReadINIVector3(char* pcSection, char* pcKey, LPCSTR cFile) { char acString[256]; tbVector3 vValue; // String lesen tbReadINIString(pcSection, pcKey, acString, 256, cFile); if (!strcmp(acString, "[NOT FOUND]")) return tbVector3(0.0f, 0.0f, 0.0f); // Die Vektorkomponenten extrahieren sscanf(acString, "%f, %f, %f", &vValue.x, &vValue.y, &vValue.z); return vValue; } // __________________________________________________________________ // Liest einen tbColor-Wert aus der INI-Datei tbColor tbReadINIColor(char* pcSection, char* pcKey, LPCSTR cFile) { char acString[256]; tbColor Value; // String lesen tbReadINIString(pcSection, pcKey, acString, 256, cFile); if (!strcmp(acString, "[NOT FOUND]")) return tbColor(0.0f, 0.0f, 0.0f, 0.0f); // Die Farbkomponenten extrahieren sscanf(acString, "%f, %f, %f, %f", &Value.r, &Value.g, &Value.b, &Value.a); return Value; } // __________________________________________________________________ // Liest einen String aus der INI-Datei tbResult tbReadINIString(char* pcSection, char* pcKey, char* pcOut, int iBufferSize, LPCSTR cFile) { // String lesen GetPrivateProfileString(pcSection, pcKey, "[NOT FOUND]", pcOut, iBufferSize, cFile); return TB_OK; } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Patrick Z.« (11.04.2017, 10:19)
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Patrick Z.« (11.04.2017, 11:31)
Werbeanzeige