QNetworkRequest request(QUrl("http://site.net/index.php"));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
QUrlQuery postData;
postData.addQueryItem("username", login);
postData.addQueryItem("password", pass);
postData.addQueryItem("submit_button", "Submit!");
QNetworkAccessManager * pManager = new QNetworkAccessManager(this);
QNetworkReply * reply = pManager->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
#include <windows.h>
#include <tlhelp32.h>
int _tmain(int argc, _TCHAR* argv[])
{
PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (Process32First(snapshot, &entry) == TRUE) {
while (Process32Next(snapshot, &entry) == TRUE) {
if (_tcsicmp(entry.szExeFile, _T("explorer.exe")) == 0) {
HANDLE hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, entry.th32ProcessID);
if (hProcess) {
TCHAR path[MAX_PATH];
DWORD cchExeName = MAX_PATH;
if (QueryFullProcessImageName(hProcess, 0, path, &cchExeName) != 0) {
_tprintf(_T("%s\r\n"), path);
}
CloseHandle(hProcess);
}
}
}
}
CloseHandle(snapshot);
return 0;
}
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, const char * argv[]) {
ifstream file("file.txt");
if (!file) {
std::cout << "Unable to open file" << std::endl;
}
string separators = " \t\r\n,.!?;:";
int i = 0;
char c;
bool lastWasSep = true;
std::string tokens[4];
std::string curToken;
while (file.get(c)) {
bool isSep = separators.find(c) != string::npos;
if (lastWasSep == isSep) {
curToken += c;
} else {
tokens[i++] = curToken;
curToken = c;
}
lastWasSep = isSep;
if (i == 4) {
cout << tokens[0] << tokens[3] << tokens[2] << tokens[1];
i = 0;
}
}
tokens[i++] = curToken;
if (i == 4) {
cout << tokens[0] << tokens[3] << tokens[2] << tokens[1];
} else {
for (int j = 0; j < i; j++) {
cout << tokens[j];
}
}
return 0;
}
signals:
void someSignal1(QString a);
void someSignal2(int a, QString b);
void someSignal3(float a, int b, QString c);
...
void someSlot(QVariant arg1,QVariant arg2, QVariant arg3);
connect(sender, &Sender::someSignal1, std::bind( &Receiver::someSlot, receiver, std::placeholders::_1, QVariant(), QVariant() ));
connect(sender, &Sender::someSignal2, std::bind( &Receiver::someSlot, receiver, std::placeholders::_1, std::placeholders::_2, QVariant()));
connect(sender, &Sender::someSignal3, std::bind( &Receiver::someSlot, receiver, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3 ));