SUCHE Script zum Datei auslesen



  • Hi!

    ich brauche ein Script zum Datei-Auslesen. Wäre nett wenn da jemand was hätte.
    Das Script soll aus einer Ini-Datei auslesen. Also ne Ini.Datei ist ja in mehrere Bereiche unterteilt. Aufbau:

    [Kategorie1]
    daksjdasa
    sdasdasdas
    dasdasdasdasd
    asdad

    [Kategorie2]
    dadasda
    dad

    Der soll also jede Kategorie einzeln auslesen.



  • Wenn deine Datei so aufgebaut ist:

    [Sektion]
    Test=Wert
    Test2=Wert2
    usw.

    Dann kannst du es so auslesen:

    DWORD dwRet;
    char chTest[MAX_PATH];
    
    dwRet = GetPrivateProfileString("Sektion1","Test","DefaultWert",chTest, sizeof(chTest),"c:\\temp\\test.ini");
    

    in chTest würde nun "Wert" stehen. Wenn "Sektion1" oder "Test" nicht gefunden werden kann, steht "DefaultWert" im char!

    Siehe auch:
    http://msdn.microsoft.com/library/en-us/sysinfo/base/getprivateprofilestring.asp

    lG



  • Ich glaube ich mache generell einen Fehler mit VC++ .NET.
    Bei mir geht gar nichts. Gar kein Code den ich im Internet finde, funktioniert. Habe vorher halt noch nie was mit dem Programm gemacht. Kriege sau viele Fehler, wenn ich den Code einfach irgendwo einfüge:

    ------ Build started: Project: inventur, Configuration: Debug Win32 ------

    Compiling...
    main.cpp
    Form1.cpp
    (...)\Form1.h(36) : error C2065: 'DWORD' : undeclared identifier
    (...)\Form1.h(36) : error C2146: syntax error : missing ';' before identifier 'dwRet'
    (...)\Form1.h(36) : error C2065: 'dwRet' : undeclared identifier
    (...)\Form1.h(37) : error C2065: 'MAX_PATH' : undeclared identifier
    (...)\Form1.h(38) : error C3861: 'dwRet': identifier not found, even with argument-dependent lookup
    (...)\Form1.h(38) : error C3861: 'GetPrivateProfileString': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(141) : error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(156) : error C2143: syntax error : missing ';' before ''
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(156) : error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(156) : error C2501: 'PDWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(157) : error C2143: syntax error : missing ';' before '
    '
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(157) : error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(157) : error C2501: 'LPDWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(348) : error C2146: syntax error : missing ';' before identifier 'FLONG'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(348) : error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(348) : error C2501: 'FLONG' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(404) : error C2146: syntax error : missing ';' before identifier 'LCID'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(404) : error C2378: 'DWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(404) : error C2501: 'LCID' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(405) : error C2146: syntax error : missing ';' before identifier 'PLCID'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(405) : error C2378: 'PDWORD' : redefinition; symbol cannot be overloaded with a typedef
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(156) : see declaration of 'PDWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(405) : error C2501: 'PLCID' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(475) : error C2146: syntax error : missing ';' before identifier 'LowPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(475) : error C2501: '_LARGE_INTEGER::$UnnamedClass$0xced1be121111::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(475) : error C2501: '_LARGE_INTEGER::$UnnamedClass$0xced1be121111::LowPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(479) : error C2146: syntax error : missing ';' before identifier 'LowPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(479) : error C2501: '_LARGE_INTEGER::$UnnamedClass$0xced1be121212::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(479) : error C2501: '_LARGE_INTEGER::$UnnamedClass$0xced1be121212::LowPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(493) : error C2146: syntax error : missing ';' before identifier 'LowPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(493) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121313::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(493) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121313::LowPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(494) : error C2146: syntax error : missing ';' before identifier 'HighPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(494) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121313::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(494) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121313::HighPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(497) : error C2146: syntax error : missing ';' before identifier 'LowPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(497) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121414::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(497) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121414::LowPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(498) : error C2146: syntax error : missing ';' before identifier 'HighPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(498) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121414::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(498) : error C2501: '_ULARGE_INTEGER::$UnnamedClass$0xced1be121414::HighPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(514) : error C2146: syntax error : missing ';' before identifier 'LowPart'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(514) : error C2501: '_LUID::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(514) : error C2501: '_LUID::LowPart' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(623) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(630) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(637) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(649) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(665) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(681) : error C2061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(790) : error C2146: syntax error : missing ';' before identifier 'Flink'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(790) : error C2501: 'LIST_ENTRY32::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(790) : error C2501: 'LIST_ENTRY32::Flink' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(791) : error C2146: syntax error : missing ';' before identifier 'Blink'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(791) : error C2501: 'LIST_ENTRY32::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(791) : error C2501: 'LIST_ENTRY32::Blink' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(809) : error C2146: syntax error : missing ';' before identifier 'Uniquifier'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(809) : error C2501: '_OBJECTID::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(809) : error C2501: '_OBJECTID::Uniquifier' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2070) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2071) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2071) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2075) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2076) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2076) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2079) : error C2146: syntax error : missing ';' before identifier '__readfsdword'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2079) : error C2501: 'DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2079) : error C2371: 'DWORD' : redefinition; different basic types
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2080) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2081) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2081) : error C2501: '__readfsdword' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2081) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2085) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2085) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2085) : error C2182: '__writefsbyte' : illegal use of type 'void'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2087) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2091) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2091) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2091) : error C2182: '__writefsword' : illegal use of type 'void'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2093) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2097) : error C3861: 'DWORD': identifier not found, even with argument-dependent lookup
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2097) : error C2146: syntax error : missing ')' before identifier 'Offset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2097) : error C2182: '__writefsdword' : illegal use of type 'void'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2099) : error C2059: syntax error : ')'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2101) : warning C4162: '__readfsbyte' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2102) : warning C4162: '__readfsword' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2103) : warning C4162: '__readfsdword' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2104) : warning C4162: '__writefsbyte' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2105) : warning C4162: '__writefsword' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2106) : warning C4162: '__writefsdword' : no function with C linkage found
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2117) : error C2064: term does not evaluate to a function taking 1 arguments
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2118) : error C2064: term does not evaluate to a function taking 1 arguments
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2178) : error C2146: syntax error : missing ';' before identifier 'ControlWord'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2178) : error C2501: '_FLOATING_SAVE_AREA::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2178) : error C2501: '_FLOATING_SAVE_AREA::ControlWord' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2179) : error C2146: syntax error : missing ';' before identifier 'StatusWord'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2179) : error C2501: '_FLOATING_SAVE_AREA::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2179) : error C2501: '_FLOATING_SAVE_AREA::StatusWord' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2180) : error C2146: syntax error : missing ';' before identifier 'TagWord'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2180) : error C2501: '_FLOATING_SAVE_AREA::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2180) : error C2501: '_FLOATING_SAVE_AREA::TagWord' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2181) : error C2146: syntax error : missing ';' before identifier 'ErrorOffset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2181) : error C2501: '_FLOATING_SAVE_AREA::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2181) : error C2501: '_FLOATING_SAVE_AREA::ErrorOffset' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2182) : error C2146: syntax error : missing ';' before identifier 'ErrorSelector'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2182) : error C2501: '_FLOATING_SAVE_AREA::DWORD' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2182) : error C2501: '_FLOATING_SAVE_AREA::ErrorSelector' : missing storage-class or type specifiers
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2183) : error C2146: syntax error : missing ';' before identifier 'DataOffset'
    C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinNT.h(2183) : fatal error C1003: error count exceeds 100; stopping compilation
    Generating Code...

    Build log was saved at "file://(...)\Debug\BuildLog.htm"
    inventur - 102 error(s), 6 warning(s)

    ---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped


Anmelden zum Antworten