English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés
Σ: 1 post

TCH  (statz) Főfasz
#1, Főfasz (10443)
1705 | #2cf3 | ^ | Idézet | Sat, 31 May 2014 20:05:30 +02
188.36.*.* Linux x86 Opera Classic Hungary *.catv.pool.telekom.hu
Hmm kemi, nem biztos, hogy az a legoptimálisabb, ha külső parancsokat hívsz meg rá, mert pl. mi van, ha nincs ps vagy grep (vagy akár tasklist, ha winfos)? Én inkább a /proc mappa túrását javallanám (legalábbis Unix alatt), gyorsabb is (nem kell a háttértárhoz nyúlni többször is), meg biztosabb is.
#include <dirent.h> 
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

long int get_pid_by_process_name(char *pname)
{
	DIR *d;
	struct dirent *dir;
	FILE *f;
	char entry[24];
	char buf[256];
	long int l;

	d = opendir("/proc");
	if (d)
	{
		while ((dir = readdir(d)) != NULL)
		{
			strcpy(entry, "/proc/");
			strcat(entry, dir->d_name);
			strcat(entry, "/cmdline");
			f = fopen(entry, "rb");
			if (f != NULL)
			{
				fread(&buf[0], 1, 256, f);
				fclose(f);
				l = -1;
				while ((++l < 257) && (buf[l]) && (buf[l] != 32));
				buf[l] -= (buf[l] == 32) << 5;
				if (l)
				{
					while ((buf[--l] != 47) && l);
					l += (buf[l] == 47);
					if (!strcmp(pname, &buf[l]))
					{
						return atol(dir->d_name);
					}
				}
			}
		}
		return -1; /* nincs ilyen */
		closedir(d);
	}
	return -2; /* nem lehet megnyitni a /proc-ot */
}
@kemi:
Ha meg olyasmit akarsz kiíratni a couttal, amit nem tud (jelen esetben egy QStringet), akkor egy ilyen függvényt kell írni:
ostream& operator<<(ostream& os, QString s)
{
    os << s.toStdString();
    return os;
}
Ööö...ezt miért kell így? Úgy nem lehet, hogy cout << s.toStdString()?
Egyébként ez nem függvény, hanem operator overload.


English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés

Név: (max 255 byte)

Email: (max 255 byte) Nem kötelező!

Üzenet: (max 65536 kar.) 65536-0=65536




crap_vkn v4.34.0 by TCH
Thx to saxus for the escaped string decoder function (PHP), the realIP function (PHP) & the SQL handle layer (PHP), to thookerov for the int_divide function (PHP), to Jeff Anderson for the getSelText function (JS), to Alex King for the insertAtCursor function (JS), Flood3r for the new CSS styles, Pety for the spamprotection idea and some design and comfort ideas, MaxMind for the IP2Country database, famfamfam for the flags of countries and an unknown PHP programmer for the removeAccents function.



Kecskebaszók ide!