diff --git a/Debug/Prog1HaziKliens.exe b/Debug/Prog1HaziKliens.exe index 1396a1da948f1cf31efd105eccb71dbf7ed0e839..5763768157852d0b341783d2c47c8e540d2682a6 100644 Binary files a/Debug/Prog1HaziKliens.exe and b/Debug/Prog1HaziKliens.exe differ diff --git a/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog b/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog index 014d14f1b7b084d1c17a3edd0a27cd5f7efac5ae..73769607a73cfde685afba8fcec3c9404d008c0d 100644 Binary files a/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog and b/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog differ diff --git a/Debug/kliensfo.obj.enc b/Debug/kliensfo.obj.enc index 1b5756114c1ec76e1972c6ecb42615eafcc8063b..c236c8ce7b4d74254c3384e5d1e74c9e9ddf0c65 100644 Binary files a/Debug/kliensfo.obj.enc and b/Debug/kliensfo.obj.enc differ diff --git a/Debug/vc140.idb b/Debug/vc140.idb index e44e05751ddbd20db5cc138e1acba44a85bda0a5..dafe7a3b04dab9faefb212fd94cceb12c6bd87de 100644 Binary files a/Debug/vc140.idb and b/Debug/vc140.idb differ diff --git a/KliensFo.c b/KliensFo.c index 68811d1ad6ceb5d1d56da80b8ed17910d7e584bb..1257eade92b4f4d4bdf2eb4fa0af063b337e6d5d 100644 --- a/KliensFo.c +++ b/KliensFo.c @@ -1,3 +1,8 @@ +/* +!!!!MINDIG x86-ra buildelj! A MySQl connector nem m�k�dik 64 biten.!!!! +*/ + + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -5,7 +10,7 @@ #include <time.h> #include <float.h> #include <math.h> -#include <dirent.h> +#include "3rdparty\dirent.h" #include "3rdparty/mysql-connector-c-6.1.11-win32\include\mysql.h" #include "3rdparty\curl-7.56.0\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl\include\curl\curl.h" char IsNaN(float f) @@ -223,14 +228,24 @@ void EszkozTombNoveles(int proba) }*/ ++EszkozokSzama; + + //if (EszkozokSzama == 1) return; // Make the array bigger EszkozokBuffer = realloc(Eszkozok, EszkozokSzama * sizeof(Eszkoz)); if (!EszkozokBuffer) { --EszkozokSzama; delay(10); EszkozTombNoveles(proba + 1); return; } + Eszkozok = EszkozokBuffer; + + + //init new element Eszkozok[EszkozokSzama - 1].OsszMukodes = 0; Eszkozok[EszkozokSzama - 1].OsszPihenes = 0; Eszkozok[EszkozokSzama - 1].OsszNincsadat = 0; + Eszkozok[EszkozokSzama - 1].OsszLogHossz = 0; + Eszkozok[EszkozokSzama - 1].Emelet = 0; + Eszkozok[EszkozokSzama - 1].Tipus = 0; + Eszkozok[EszkozokSzama - 1].MukodesArany = 0; //printf_s("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); // Clean up when you're done. @@ -540,6 +555,7 @@ char *szambuff3; char *szambuff4; char *szambuff5; char *szambuff6; + void EnumString(struct string s, char OnlineMode /*0: Offline, M�s: Online*/) { int Emelet = -99999; @@ -548,7 +564,7 @@ void EnumString(struct string s, char OnlineMode /*0: Offline, M logsor l; int i = 0; int x; - printf("EnumString() 0-->s.len = %d\n", s.len); + printf(" EnumString() 0-->s.len = %d\n", s.len); for (; i < s.len; ++i) { if (StartsWith(s, i, " id=\"f", 6))//�j emelet indexe @@ -667,7 +683,7 @@ void EnumString(struct string s, char OnlineMode /*0: Offline, M delay(30); - printf("Creating row: %d %d %d %d -> ", l.Tipus, l.Emelet, l.Statusz, l.Hossz); + printf("Creating row: Type: %d Floor: %d Status: %d Duration: %ds -> ", l.Tipus, l.Emelet, l.Statusz, l.Hossz); if (SqlInsert(l) == 0) printf("Succeeded.\n"); else @@ -690,8 +706,11 @@ void EnumString(struct string s, char OnlineMode /*0: Offline, M Eszkozok[x].OsszPihenes += 5 * 60; else if (l.Statusz == 1)//Akt�v Eszkozok[x].OsszMukodes += 5 * 60; - else //N/ + else //N/A Eszkozok[x].OsszNincsadat += 5 * 60; + + + printf_s(" ==>Gathered data: Type: %d Floor: %d Status: %d\n", l.Tipus, Emelet, l.Statusz); } } @@ -704,6 +723,7 @@ struct string sEgyLog; struct string xEgyLog; void EgyLogKeszito() { + int dekodolthossz; printf("Creating new log...\n============================\n"); @@ -724,7 +744,15 @@ void EgyLogKeszito() }*/ //x.len = 10000; + xEgyLog.ptr = realloc(xEgyLog.ptr, sEgyLog.len * sizeof(char));//Ez biztosan nagyobb, vagy akkora, mint a dek�dol�s ut�ni karakterl�nc + xEgyLog.len = utf8_to_latin9(xEgyLog.ptr, sEgyLog.ptr, sEgyLog.len); + + + //writefunc("ABCDEFABCDEF", dekodolthossz, 1, &xEgyLog); + + //printf("INSTRING: %s", sEgyLog.ptr); + printf("EgyLogKeszito() 2\n"); EnumString(xEgyLog, 1); @@ -770,16 +798,17 @@ void Logolas() curl_easy_setopt(curl, CURLOPT_URL, "http://mosogep.sch.bme.hu/index.php"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sEgyLog); curl_easy_setopt(curl, CURLOPT_ENCODING, "UTF-8"); while (1) { //init_string(&sEgyLog); //init_string(&xEgyLog); + + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sEgyLog); EgyLogKeszito(); printf("Delaying %ds ... ", logdelay); - sEgyLog.len = 0;//K�l�nben a k�vetkez� WebRequest ehhez (az el�z�h�z) �rn� hozz� az eredm�nyt + //sEgyLog.len = 0;//K�l�nben a k�vetkez� WebRequest ehhez (az el�z�h�z) �rn� hozz� az eredm�nyt free(sEgyLog.ptr); //xEgyLog.len = 0; //free(xEgyLog.ptr); @@ -827,7 +856,9 @@ int GetHossz(char *p, int h) void OfflineMod() { FILE *f; - long fsize, fsizeelozo = 0; + DIR *dir; + struct dirent *ent; + long fsize, fsizeelozo = 10; char *fajltart = malloc(10); char *olvasandofile = malloc(10); @@ -838,8 +869,6 @@ void OfflineMod() //init_string(&sEgyLog); init_string(&xEgyLog); - DIR *dir; - struct dirent *ent; if ((dir = opendir("offline")) != NULL) { /* print all the files and directories within directory */ @@ -850,16 +879,19 @@ void OfflineMod() printf("FILE: '%s'\n", ent->d_name); olvasandofile = realloc(olvasandofile, 9 + ent->d_namlen); - strcpy(olvasandofile, "offline\\"); - strcat(olvasandofile, ent->d_name); + strcpy_s(olvasandofile, 9, "offline\\"); + strcat_s(olvasandofile, 9 + ent->d_namlen, ent->d_name); - f = fopen(olvasandofile, "rb"); + fopen_s(&f,olvasandofile, "rb"); fseek(f, 0, SEEK_END); - fsize = ftell(f) + 1;//A f�jl k�dol�s�t�l f�gg�en lehet, hogy egy karaktert k�t byte reprezent�l + fsize = ftell(f) + 1; fseek(f, 0, SEEK_SET); //same as rewind(f); - if(fsize > fsizeelozo) + if (fsize > fsizeelozo) + { fajltart = realloc(fajltart, fsize + 1); + xEgyLog.ptr = realloc(xEgyLog.ptr, fsize * sizeof(char));//Ez biztosan nagyobb, vagy akkora, mint a dek�dol�s ut�ni karakterl�nc + } fsizeelozo = fsize; delay(10); @@ -872,9 +904,10 @@ void OfflineMod() fajltart[fsize - 1] = 0; xEgyLog.len = utf8_to_latin9(xEgyLog.ptr, fajltart, fsize); - - EnumString(xEgyLog, 0); + printf("\n"); + + fsize = fsize;//DEBUG //sEgyLog.len = 0;//K�l�nben a k�vetkez� WebRequest ehhez (az el�z�h�z) �rn� hozz� az eredm�nyt //free(sEgyLog.ptr); @@ -895,9 +928,9 @@ void OfflineMod() else { /* could not open directory */ - perror(""); + //perror(""); - printf("\nFile handling error...\n"); + printf("\nFile handling error... Directory cannot be opened!\n"); return EXIT_FAILURE; } diff --git a/Prog1Hazi.vcxproj b/Prog1Hazi.vcxproj index 68421a2580818f2c30b4546f661babf18f6623cd..ec7ec04d0ad8d1168d8ce3404b69efeb35cd177a 100644 --- a/Prog1Hazi.vcxproj +++ b/Prog1Hazi.vcxproj @@ -92,7 +92,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(ProjectDir)3rdparty\mysql-connector-c-6.1.11-win32\include;$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> @@ -109,8 +109,9 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> + <AdditionalIncludeDirectories>$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Console</SubSystem> @@ -125,7 +126,7 @@ <Optimization>Disabled</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> <AdditionalIncludeDirectories>$(ProjectDir)3rdparty\mysql-connector-c-6.1.11-win32\include;$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> @@ -146,8 +147,9 @@ <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> <SDLCheck>true</SDLCheck> + <AdditionalIncludeDirectories>$(ProjectDir)3rdparty;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Console</SubSystem> diff --git a/Release/Prog1HaziKliens.exe b/Release/Prog1HaziKliens.exe index 8eab90f2c744c17951e6f60a262b4858eb170bef..6d2da386d97d151d73e146d2c5db26a4a3b7a273 100644 Binary files a/Release/Prog1HaziKliens.exe and b/Release/Prog1HaziKliens.exe differ diff --git a/Release/Prog1HaziKliens.iobj b/Release/Prog1HaziKliens.iobj index ef190150d1c305e9eaa00730318ea57f952c104d..094966d8bc2a910b743b2e6cf60b8b92fb2018b4 100644 Binary files a/Release/Prog1HaziKliens.iobj and b/Release/Prog1HaziKliens.iobj differ diff --git a/Release/Prog1HaziKliens.ipdb b/Release/Prog1HaziKliens.ipdb index 848145a7bcbbd400ab01e23169bd1963065d62ba..08b9414b41099f61419cf399044016783aa00fd9 100644 Binary files a/Release/Prog1HaziKliens.ipdb and b/Release/Prog1HaziKliens.ipdb differ diff --git a/Release/Prog1HaziKliens.tlog/CL.command.1.tlog b/Release/Prog1HaziKliens.tlog/CL.command.1.tlog index 2f95dc4561635e92cbf4568eaa010780ee35e301..d8f744e148d6f0ca524c8c1af70450f56527d827 100644 Binary files a/Release/Prog1HaziKliens.tlog/CL.command.1.tlog and b/Release/Prog1HaziKliens.tlog/CL.command.1.tlog differ diff --git a/Release/Prog1HaziKliens.tlog/link.write.1.tlog b/Release/Prog1HaziKliens.tlog/link.write.1.tlog index af42422abfb020a9f17c8087483d04336699c7b1..53b41c7ee8da7c44202f4c182a082e1cba8912fb 100644 Binary files a/Release/Prog1HaziKliens.tlog/link.write.1.tlog and b/Release/Prog1HaziKliens.tlog/link.write.1.tlog differ diff --git a/x64/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..baf099185aab66f54719a0f9384653509114f556 Binary files /dev/null and b/x64/Debug/Prog1HaziKliens.tlog/CL.command.1.tlog differ diff --git a/x64/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..c19c9f13eb4b22289c55d1222e30f075fe97fb07 Binary files /dev/null and b/x64/Debug/Prog1HaziKliens.tlog/CL.read.1.tlog differ diff --git a/x64/Debug/Prog1HaziKliens.tlog/CL.write.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/CL.write.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..ef17801fe03ea99a3f38c304d8eb3945c36797c3 Binary files /dev/null and b/x64/Debug/Prog1HaziKliens.tlog/CL.write.1.tlog differ diff --git a/x64/Debug/Prog1HaziKliens.tlog/Prog1HaziKliens.lastbuildstate b/x64/Debug/Prog1HaziKliens.tlog/Prog1HaziKliens.lastbuildstate new file mode 100644 index 0000000000000000000000000000000000000000..61bfa47234e15e416d9cee00eec07f7f90bea6e9 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/Prog1HaziKliens.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|x64|D:\Users\gatsj\Documents\Visual Studio 2015\Projects\Prog1Hazi\| diff --git a/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.read.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.read.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.read.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.write.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.write.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link-cvtres.write.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link-rc.read.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link-rc.read.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link-rc.read.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link-rc.write.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link-rc.write.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link-rc.write.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link.command.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link.command.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link.command.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link.read.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link.read.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link.read.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/link.write.1.tlog b/x64/Debug/Prog1HaziKliens.tlog/link.write.1.tlog new file mode 100644 index 0000000000000000000000000000000000000000..46b134b197f35e75e0784bedbf94a8dd124693b1 --- /dev/null +++ b/x64/Debug/Prog1HaziKliens.tlog/link.write.1.tlog @@ -0,0 +1 @@ +�� \ No newline at end of file diff --git a/x64/Debug/Prog1HaziKliens.tlog/unsuccessfulbuild b/x64/Debug/Prog1HaziKliens.tlog/unsuccessfulbuild new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/x64/Debug/vc140.idb b/x64/Debug/vc140.idb new file mode 100644 index 0000000000000000000000000000000000000000..5360f1246321f26a9de04851bd03218785f22801 Binary files /dev/null and b/x64/Debug/vc140.idb differ