GithubHelp home page GithubHelp logo

Comments (7)

JosephP91 avatar JosephP91 commented on August 21, 2024

hello @brightening-eyes ,
Can you report me the piece of code (properly formatted) where you are using curlcpp?
Thank you!

from curlcpp.

brightening-eyes avatar brightening-eyes commented on August 21, 2024

hi,
this is the hole declared updater class:

class updater
{
public:
updater();
~updater();
void update();

private:
boost::property_tree::ptree pt; //container containing the xml data
std::stringstream xml_data; //the xml data string update file
std::fstream writer; //the file writer stream
curl::curl_ios<std::stringstream> xmlcontents; //the contents of xml file
curl::curl_ios<std::fstream> filewriter; //for the update file
bool update_available; //weather update is available or not
curl::curl_easy e; //for getting the xml file that refers to update download link
curl::curl_easy downloader; //for getting the update file
};`````c++

and this is my constructor which i want to initialize the variables:

`````c++
updater::updater():
writer("missiontimesetup.exe", ios::binary|ios::out|ios::trunc),
xmlcontents(xml_data, nullptr),
filewriter(writer, nullptr),
e(xmlcontents),
downloader(filewriter)
{
try
{
e.add<CURLOPT_URL>("http://amir-ramezani.3owl.com/update.xml");
e.perform();
}
catch(curl_easy_exception &e)
{
Tolk_Speak((wchar_t*)e.what(), false);
exit(1);
}
read_xml(xmlcontents.get_stream()->str(), pt);
if(pt.get<string>("update.version")==mt_version)
{
update_available=false;
}
else
{
update_available=true;
downloader.add<CURLOPT_URL>(pt.get<string>("update.url").c_str());
}
}
`````c++

i get errors in curl_ios.h line 69
when i write 

`````c++
xmlcontents(xml_data)
`````c++

i get some other errors again.
thanks

from curlcpp.

JosephP91 avatar JosephP91 commented on August 21, 2024

@brightening-eyes With the last commit, the error with curl_ios should be fixed. I've added a template specialization for stringstream. Can you try and let me know? (obviously you have to update your working copy of curlcpp)

from curlcpp.

brightening-eyes avatar brightening-eyes commented on August 21, 2024

hi again,
the errors reduced to 1
`
mt build log
Build started on: 12-02-2016 at 00:20.41
Build ended on: 12-02-2016 at 00:20.56

-------------- Build: Debug in mt (compiler: GNU GCC Compiler)---------------
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_cookie.cpp -o obj\Debug\src\curl_cookie.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_easy.cpp -o obj\Debug\src\curl_easy.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_exception.cpp -o obj\Debug\src\curl_exception.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_form.cpp -o obj\Debug\src\curl_form.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_header.cpp -o obj\Debug\src\curl_header.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_info.cpp -o obj\Debug\src\curl_info.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_multi.cpp -o obj\Debug\src\curl_multi.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\curl_share.cpp -o obj\Debug\src\curl_share.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\keyhook.cpp -o obj\Debug\src\keyhook.o
g++.exe -std=c++14 -Wall -fpermissive -g -IF:\projects\cpp\mt\include -c F:\projects\cpp\mt\src\updater.cpp -o obj\Debug\src\updater.o
F:\projects\cpp\mt\src\keyhook.cpp: In function 'void install_keyhook()':
F:\projects\cpp\mt\src\keyhook.cpp:59:96: warning: invalid conversion from 'LRESULT ()(int, LPARAM, WPARAM) {aka long int ()(int, long int,
unsigned int)}' to 'HOOKPROC {aka long int (attribute((stdcall)) )(int, unsigned int, long int)}' [-fpermissive]
keyhk_installed=hk=SetWindowsHookEx( WH_KEYBOARD_LL, keyboard_hook, GetModuleHandle(nullptr), 0);
^
In file included from C:/Dev-Cpp/i686-w64-mingw32/include/windows.h:72:0,
from F:\projects\cpp\mt\src\keyhook.cpp:6:
C:/Dev-Cpp/i686-w64-mingw32/include/winuser.h:3840:27: note: initializing argument 2 of 'HHOOK
__ SetWindowsHookExA(int, HOOKPROC, HINSTANCE, DWORD)'
WINUSERAPI HHOOK WINAPI SetWindowsHookExA (int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId);
^
F:\projects\cpp\mt\src\keyhook.cpp:59:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
keyhk_installed=hk=SetWindowsHookEx( WH_KEYBOARD_LL, keyboard_hook, GetModuleHandle(nullptr), 0);
^
g++.exe -o bin\Debug\mt.exe obj\Debug\src\curl_cookie.o obj\Debug\src\curl_easy.o obj\Debug\src\curl_exception.o obj\Debug\src\curl_form.o obj\Debug\src\curl_header.o
obj\Debug\src\curl_info.o obj\Debug\src\curl_multi.o obj\Debug\src\curl_share.o obj\Debug\src\keyhook.o obj\Debug\src\updater.o -static -static-libgcc
-static-libstdc++ -msse -mthreads -mwindows -lsdl2 -lsdl2main -lsdl2_test -lkNet -ltolk -lnghttp2 -ladvapi32 -luser32 -lole32 -loleaut32 -lgdi32 -lgdiplus
-lcomctl32 -lcomdlg32 -lwsock32 -lws2_32 -lkernel32 -lcurl
In file included from F:\projects\cpp\mt\include/curl_easy.h:36:0,
from F:\projects\cpp\mt\src\updater.hpp:9,
from F:\projects\cpp\mt\src\updater.cpp:8:
F:\projects\cpp\mt\include/curl_ios.h: In instantiation of 'curl::curl_ios::curl_ios(T&, curlcpp_callback_type) [with T = std::basic_fstream;
curlcpp_callback_type = unsigned int ()(void, unsigned int, unsigned int, void_); size_t = unsigned int]':
F:\projects\cpp\mt\src\updater.cpp:21:22: required from here
F:\projects\cpp\mt\include/curl_ios.h:69:81: error: cannot convert 'std::basic_fstream' to 'std::basic_fstream_' in initialization
curl_ios(T &stream, curlcpp_callback_type callback_ptr) : _stream(stream) {
^
Process terminated with status 1 (0 minute(s), 14 second(s))
1 error(s), 4 warning(s) (0 minute(s), 14 second(s))
`
now, i think a template specialization for std::fstream should be added
and actually, std::streambuf, std::iostream, std::stringbuf, etc should be added
for example, basic_fstream should be added in order for std::ifstream or std::ofstream to work, it should be a way to be able to have curl_ios with custom streams like boost's streams
thanks

from curlcpp.

JosephP91 avatar JosephP91 commented on August 21, 2024

You're right. I will provide those classes in the next commit (few days). Thank you!

from curlcpp.

JosephP91 avatar JosephP91 commented on August 21, 2024

Hi @brightening-eyes ,
Can you check if everything works now? For now, I have added the fstream specialization to let you finish your game updater. I will add more specializations in the next days. Thank you and let me know. If everything works feel free to close the issue.

from curlcpp.

brightening-eyes avatar brightening-eyes commented on August 21, 2024

hello,
thanks in advance, no errors

from curlcpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.