c++ Download string simple

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Who Will You Kiss
Seçkin Üye
Katılım
18 Nis 2020
Mesajlar
549
Çözümler
4
Tepki puanı
145
6 HİZMET YILI
Kod:
#include <Windows.h>
#include <string>
#include <iostream>
#include <Wininet.h>
#include <string>
#pragma comment(lib, "wininet.lib")
using namespace std;


string replaceAll(string subject, const string& search,
    const string& replace) {
    size_t pos = 0;
    while ((pos = subject.find(search, pos)) != string::npos) {
        subject.replace(pos, search.length(), replace);
        pos += replace.length();
    }
    return subject;
}
 
string DownloadString(string URL) {
    HINTERNET interwebs = InternetOpenA("Mozilla/5.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
    HINTERNET urlFile;
    string rtn;
    if (interwebs) {
        urlFile = InternetOpenUrlA(interwebs, URL.c_str(), NULL, NULL, NULL, NULL);
        if (urlFile) {
            char buffer[2000];
            DWORD bytesRead;
            do {
                InternetReadFile(urlFile, buffer, 2000, &bytesRead);
                rtn.append(buffer, bytesRead);
                memset(buffer, 0, 2000);
            } while (bytesRead);
            InternetCloseHandle(interwebs);
            InternetCloseHandle(urlFile);
            string p = replaceAll(rtn, "|n", "\r\n");
            return p;
        }
    }
    InternetCloseHandle(interwebs);
    string p = replaceAll(rtn, "|n", "\r\n");
    return p;
}

int main() {
    string roxtestab = DownloadString("https://örneklink.net/raw/");
    cout << roxtestab << endl;
    return 0;
}
 
Hile kullanmak kolsuzluk değil akıllılıktır
Banlı Üye
Katılım
16 May 2019
Mesajlar
1,073
Çözümler
8
Tepki puanı
204
Ödüller
4
Yaş
24
7 HİZMET YILI
hocam zip indirip onu c:\windows\Program Files\ (burda winfiles adlı bir klasör oluşturarak) onu buraya excract edip gerçeğini silebilirmiyiz (zip dosyasını)
 
Üye
Katılım
22 Ara 2019
Mesajlar
11
Tepki puanı
1
Ödüller
2
Yaş
27
6 HİZMET YILI
usta siz nasil busekilde calsiyonu z helal valla emek ister kafam yorulur ben yapsam elinesalik .
 
ERROR PROBLEM FIXER
Support
Katılım
25 Eyl 2018
Mesajlar
5,366
Çözümler
1,450
Tepki puanı
2,351
Ödüller
20
Sosyal
7 HİZMET YILI
its a good project apricate your hard working :mum:
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst