C De Programın Kapanması Eventi
-
GrN bunu yazdı:
-----------------------------
#include #include HANDLE g_hThr; DWORD g_dwThrID; DWORD WINAPI thr_wait(LPVOID p); int main(int argc, char* argv[]) { g_hThr = CreateThread(NULL, 0, thr_wait, NULL, 0, &g_dwThrID); char buff[512]; if (g_hThr == NULL) { perror("thread"); return 0; } gets_s(buff, 512); if (!strcmp(buff, "Sifre")) return 0; TerminateThread(g_hThr, 0); /*programin kodlari*/ return 0; } DWORD WINAPI thr_wait(LPVOID p) { Sleep(60 * 1000); exit(-1); return 0; }ornek olsun ;-)
-----------------------------500 evler yeşil cami ye gel, öpüjem :D çok sağol hocam :D
-
hocam şu gets_s() kısmına alternatif bir kodun varmı, VS dışında çalıştırmıyor o kodu. fgets() falan denedim ama yemedi, yada ben yediremedim :D
-
hangi derleyicide deniyosun ki?
pelles c de de varmis :s
dev cpp mi kullaniyosun -
GrN bunu yazdı:
-----------------------------
hangi derleyicide deniyosun ki?
pelles c de de varmis :s
dev cpp mi kullaniyosun
-----------------------------evet hocam dev-cpp,
pelleste 100 den fazla hata verdi onu hiç açma :D
-
VBDream bunu yazdı:
-----------------------------
GrN bunu yazdı:
-----------------------------
hangi derleyicide deniyosun ki?
pelles c de de varmis :s
dev cpp mi kullaniyosun
-----------------------------evet hocam dev-cpp,
-----------------------------char *mygets(char *buff, size_t n) { size_t i; int ch; for (i = 0; i < n - 1 && (ch = getchar()) != '\n'; ++i) buff[i] = ch; buff[i] = '\0'; return buff; }gets_s yerine kullan ;-)
-
cok saol hocam
-
pelles c de win32 fonksiyonlarini kullanmak icin cok basit iki uc ayar yaparsin ve bu sayede bence devcpp'dan daha guzel bi derleyiciye sahip olursun :-)
menu->project->project options
compiler tab'i
centikler var sagda, Enable Microsoft Extensions centigini isaretle
;-)
