Solved Reading file from hosting/server [C++]

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

getox

Newbie
Full Member
Feb 18, 2014
21
162
1
I need read file from dropbox
I can do it on C#

code:
C#:
 HttpWebRequest request;
            request = WebRequest.Create(url) as HttpWebRequest;
            using (System.Net.WebResponse tmpRes = request.GetResponse())
            {
                using (System.IO.Stream tmpStream = tmpRes.GetResponseStream())
                {
                    using (StreamReader sr = new StreamReader(tmpRes.GetResponseStream(), Encoding.GetEncoding(1251)))
                    {
                        for (; ; ) // while (true)
                        {
                            if (sr.EndOfStream == true)
                            {
                                return false;
                            }
                            string s = sr.ReadLine();
                        }
                    }
                }
            }
but I dont understand, how do it on C++
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
Yes, .txt
Link for example: dropbox.com/example.txt
C++:
#include <tchar.h>
#include <urlmon.h>
#pragma comment(lib, "urlmon.lib")

int main()
{
    HRESULT hr = URLDownloadToFile(NULL, _T("https://guidedhacking.com/"), _T("C:\\guidedhacking.html"), 0, NULL);
    return 0;
}
Works for me. Credits to the people on StackOverflow. I assume if you have the correct download URL, you could place the TXT file somewhere, read from it, then delete it afterwards.

EDIT:
Tried it with a regular download link, and it downloads the URL page (Go figure heh). You can try cURL, never used it so I can't really say whether or not it would work in this situation.
 
Last edited:

keto

Dank Tier Donator
Nobleman
May 25, 2013
151
1,648
1
Well I'd say you need to learn C++ for that. Since C++ is not managed just as C# is, you have to create something yourself.
 

keto

Dank Tier Donator
Nobleman
May 25, 2013
151
1,648
1
I took a quick second with my friend Google and he gave me this. I hope this can help you. I am unable to create an example for you, since I never did something like that. What kind of file would you like to read from dropbox? .txt?
 

getox

Newbie
Full Member
Feb 18, 2014
21
162
1
I took a quick second with my friend Google and he gave me this. I hope this can help you. I am unable to create an example for you, since I never did something like that. What kind of file would you like to read from dropbox? .txt?
Yes, .txt
Link for example: dropbox.com/example.txt
 

getox

Newbie
Full Member
Feb 18, 2014
21
162
1
C++:
#include <tchar.h>
#include <urlmon.h>
#pragma comment(lib, "urlmon.lib")

int main()
{
    HRESULT hr = URLDownloadToFile(NULL, _T("https://guidedhacking.com/"), _T("C:\\guidedhacking.html"), 0, NULL);
    return 0;
}
Works for me. Credits to the people on StackOverflow. I assume if you have the correct download URL, you could place the TXT file somewhere, read from it, then delete it afterwards.

EDIT:
Tried it with a regular download link, and it downloads the URL page (Go figure heh). You can try cURL, never used it so I can't really say whether or not it would work in this situation.
It real without download?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods