开发者

Can't send file from the appdata folder C++

开发者 https://www.devze.com 2023-03-03 21:08 出处:网络
So I was able to get the AppData folder via SHGetKnownFolderPath and converted the memory address it printed to a readable string via

So I was able to get the AppData folder via SHGetKnownFolderPath and converted the memory address it printed to a readable string via

SHGetKnownFolderPath(FOLDERID_RoamingAppData, NULL, NULL, &wszPath);
_bstr_t bstrPath(wszPath);
std::string strPath((char*)bstrPath); 

newstring.append(strPath); 
newstring.append(secondvar); 

So you probably noticed the newstring.append. What I do is append the folder name I want and file to the end of the AppData location which is C:\Users\*Username*\AppData\Roaming(and append here my folder and file).

T开发者_高级运维hen I use cURL to send the file from newstring to my cURL function called sendfile, however because of the hacks I tried to convert the memory address to a readable string and then append the other information, I then got a heap corrupted message.

I then tried manually putting the path to the directory and file to cURL function curl_formadd and it still wouldn't work. However, if there is a file where the application is, and use it for sending through HTTP, it works. If I add a full path, i.e C:\Users\*Username*\AppData\Roaming\myfolder\myfile.txt to the curl_formadd function, nothing happens.

So how do I go about fetching that file from the directory I want and sending it with cURL?

0

精彩评论

暂无评论...
验证码 换一张
取 消