-
August 12th, 2019, 03:39 AM
#31
Re: How to convert const std::filesystem::directory_entry to tchar?
Nice, it works. Maybe it's possible to put "Space" between?
-
August 12th, 2019, 03:46 AM
#32
Re: How to convert const std::filesystem::directory_entry to tchar?
Yes. if you want a separator, just replace ""s with "separator"s eg " "s
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 12th, 2019, 03:56 AM
#33
Re: How to convert const std::filesystem::directory_entry to tchar?
Weird. Seems I tried it before but probably I did something else.
Edited: remebered that I tried this "' '"s.
Last edited by prako2; August 12th, 2019 at 04:00 AM.
-
August 13th, 2019, 03:03 PM
#34
Re: How to convert const std::filesystem::directory_entry to tchar?
It doesn't work on the other email. I'm getting weird symbols again and everytime I try, they are different. Do you know why it could be?
-
August 13th, 2019, 03:10 PM
#35
Re: How to convert const std::filesystem::directory_entry to tchar?
Originally Posted by prako2
It doesn't work on the other email. I'm getting weird symbols again and everytime I try, they are different. Do you know why it could be?
Could you post your actual code?
Victor Nijegorodov
-
August 14th, 2019, 03:12 AM
#36
Re: How to convert const std::filesystem::directory_entry to tchar?
const string s3 = region + " "s + regionName;
printf("%s\n", s3.c_str());
email.put_Subject(s3.c_str());
-
August 14th, 2019, 03:28 AM
#37
Re: How to convert const std::filesystem::directory_entry to tchar?
Originally Posted by prako2
const string s3 = region + " "s + regionName;
printf("%s\n", s3.c_str());
email.put_Subject(s3.c_str());
Where and how are these region and regionName defined/initialized?
Did you debug your code? are the values of these variables correct (the same that were by initialization)?
Did you try something like
Code:
string s3 = region;
s3 += " ";
s3 += regionName;
instead?
Victor Nijegorodov
-
August 14th, 2019, 04:11 AM
#38
Re: How to convert const std::filesystem::directory_entry to tchar?
Code:
region = json.stringOf("region");
regionName = json.stringOf("regionName");
What are the contents of region & regionName after the assignment here? Are they null-terminated c-style strings?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 14th, 2019, 04:58 AM
#39
Re: How to convert const std::filesystem::directory_entry to tchar?
Instead of "Respublic of Lithuania (next pointer)78.63.209.141" I'm getting xnŪ 78.63.209.141 or ΓΈąį 78.63.209.141. It works well in Gmail but not in Yandex.
-
August 14th, 2019, 08:30 AM
#40
Re: How to convert const std::filesystem::directory_entry to tchar?
When issues arise dealing with c-style strings, It is often useful to see the actual contents of the memory used in both hex and char display. Something like this:
Code:
void display(const char* str)
{
for (auto s = str; *s; ++s)
printf("%hhx ", *s);
for (auto s = str; *s; ++s)
printf("%c ", *s);
puts("");
}
int main()
{
const char* cc1 = "my";
const char* cc2 = "name";
const string s3 = cc1 + ""s + cc2;
display(cc1);
display(cc2);
display(s3.c_str());
printf("%s\n", s3.c_str());
return 0;
}
which displays:
Code:
6d 79 m y
6e 61 6d 65 n a m e
6d 79 6e 61 6d 65 m y n a m e
myname
then if there seems to be a problem, you can see what is the underlying data.
So in your code, I suggest before the .put_Subject():
Code:
display(region);
display(regionName);
display(s3.c_str());
If this doesn't display as expected, then you know in which variable the error lies. if this all displays as expected, then the issue is with .putSubject().
PS Are you compiling as Unicode or Multi Byte Character Set? If Multi Byte, what encoding are you using - ASCII, utf-8, utf-16 etc?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 14th, 2019, 02:27 PM
#41
Re: How to convert const std::filesystem::directory_entry to tchar?
-
August 14th, 2019, 05:20 PM
#42
-
August 15th, 2019, 04:28 AM
#43
Re: How to convert const std::filesystem::directory_entry to tchar?
I suspect this is the answer to the PS in post #40, and means that the Character Set property for the project is 'Not Set'. In which case I suggest changing it to 'Multi-byte character set' - and also saying what is the output from using the display() functions as also suggested in post #40.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 24th, 2019, 07:38 AM
#44
Re: How to convert const std::filesystem::directory_entry to tchar?
VictorN, I'm sorry for being rude. 2kaud Thanks for helpful tips but I changed my code and I'm not able to test it.
-
August 24th, 2019, 07:50 AM
#45
Re: How to convert const std::filesystem::directory_entry to tchar?
Originally Posted by prako2
VictorN, I'm sorry for being rude. 2kaud Thanks for helpful tips but I changed my code and I'm not able to test it.
Better late than never...
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|