Click here to Skip to main content
14,331,896 members

ATL / WTL / STL

 
PraiseRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 23:53
professionalVISWESWARAN19989-Feb-17 23:53 
PraiseRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 23:07
professionalVISWESWARAN19989-Feb-17 23:07 
AnswerRe: STL std::string help needed Pin
Jochen Arndt8-Feb-17 22:29
mveJochen Arndt8-Feb-17 22:29 
GeneralRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 4:00
professionalVISWESWARAN19989-Feb-17 4:00 
GeneralRe: STL std::string help needed Pin
Jochen Arndt9-Feb-17 4:12
mveJochen Arndt9-Feb-17 4:12 
GeneralRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 19:52
professionalVISWESWARAN19989-Feb-17 19:52 
AnswerRe: STL std::string help needed Pin
Daniel Pfeffer9-Feb-17 6:17
professionalDaniel Pfeffer9-Feb-17 6:17 
GeneralRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 7:27
professionalVISWESWARAN19989-Feb-17 7:27 
Thank you for your solution sir but the wide character is something like this,

L"F:\\dupelicateFinder\\New folder\\New folder\\检查.jpg"

so I am converting it to the string by the above method described by you,

"F:\\dupelicateFinder\\New folder\\New folder\\检查.jpg"

I've have already found a way to convert the std::string to char* using strcppy so finally I get this,

"F:\\dupelicateFinder\\New folder\\New folder\\检查.jpg"

the same thing as of string, but I have a function( from 3rd party library) which takes char* as an argument so, I have char* value as F:\\dupelicateFinder\\New folder\\New folder\\检查.jpg

but the function shows returns -1(file not found) since the unicode fonts didn't changed from 检查.jpg to 检查.jpg so how to open the file using that function

I have checked the work flow of this function using Debugger by creating the break-points and checked the values using Immediate window.

Below is my code:

// Template is passed as wstring i.e duplicates is equal to std::wstring
template<typename duplicates>
std::string Duplicates<duplicates>::compute_hash(duplicates file_loc)
{
	std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
	std::string narrow_target = converter.to_bytes(file_loc);
	char *cstr = new char[narrow_target.length() + 1];
	strcpy(cstr, narrow_target.c_str());
	 //This function takes char* as an argument
	std::string hash = CALL_MD5_Function(cstr);
	delete[] cstr;
	std::cout << hash;
	return hash;
}


modified 10-Feb-17 1:57am.

GeneralRe: STL std::string help needed Pin
Daniel Pfeffer11-Feb-17 7:36
professionalDaniel Pfeffer11-Feb-17 7:36 
QuestionRe: STL std::string help needed Pin
VISWESWARAN199812-Feb-17 0:18
professionalVISWESWARAN199812-Feb-17 0:18 
AnswerRe: STL std::string help needed Pin
Daniel Pfeffer12-Feb-17 0:47
professionalDaniel Pfeffer12-Feb-17 0:47 
PraiseRe: STL std::string help needed Pin
VISWESWARAN199812-Feb-17 4:25
professionalVISWESWARAN199812-Feb-17 4:25 
PraiseRe: STL std::string help needed Pin
VISWESWARAN19989-Feb-17 23:54
professionalVISWESWARAN19989-Feb-17 23:54 
QuestionMultiple Inheritance question Pin
samzcs25-Dec-16 17:31
membersamzcs25-Dec-16 17:31 
GeneralRe: Multiple Inheritance question Pin
Richard MacCutchan25-Dec-16 20:36
protectorRichard MacCutchan25-Dec-16 20:36 
GeneralRe: Multiple Inheritance question Pin
samzcs26-Dec-16 7:51
membersamzcs26-Dec-16 7:51 
GeneralRe: Multiple Inheritance question Pin
Richard MacCutchan26-Dec-16 21:29
protectorRichard MacCutchan26-Dec-16 21:29 
AnswerRe: Multiple Inheritance question Pin
Vi228-Dec-16 18:35
memberVi228-Dec-16 18:35 
GeneralRe: Multiple Inheritance question Pin
samzcs28-Dec-16 18:40
membersamzcs28-Dec-16 18:40 
QuestionCalling a MFC dialog from win32 Pin
rdeekonda29-Jul-16 5:46
memberrdeekonda29-Jul-16 5:46 
AnswerRe: Calling a MFC dialog from win32 Pin
Afzaal Ahmad Zeeshan29-Jul-16 6:01
mveAfzaal Ahmad Zeeshan29-Jul-16 6:01 
GeneralRe: Calling a MFC dialog from win32 Pin
rdeekonda29-Jul-16 7:04
memberrdeekonda29-Jul-16 7:04 
AnswerRe: Calling a MFC dialog from win32 Pin
Richard MacCutchan29-Jul-16 6:46
protectorRichard MacCutchan29-Jul-16 6:46 
GeneralRe: Calling a MFC dialog from win32 Pin
rdeekonda29-Jul-16 7:08
memberrdeekonda29-Jul-16 7:08 
GeneralRe: Calling a MFC dialog from win32 Pin
Richard MacCutchan29-Jul-16 22:19
protectorRichard MacCutchan29-Jul-16 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.