|
Hi,
currently I am comparing the MeshCommander and the Intel Manageability Commander for configuring AMT Version 12.
With the MeshCommander I was able to configure AMT Version 12 for a TLS connection.
But I found no way to do the same with the Intel Manageability Commander.
1. Where are the setting in the Intel Manageability Commander for TLS configuration?
2. How can I configure TLS with Intel Manageability Commander?
Regards and thanks in advance for helpful answers
jo123
|
|
|
|
|
This has nothing to do with C/C++/MFC, or indeed software in general. Please find a more appropriate forum.
|
|
|
|
|
I am trying to convert a CString to const char*, and I have tried some versions:
CString sTemp("abcd");
const char* chTemp = (LPCSTR)(LPCTSTR)sTemp;
is one of them, but in chTemp I have only one letter from sTemp, not whole string ... why ?
|
|
|
|
|
|
I have converted the project to multi-byte character set (was unicode) and the behavior is the same ...
|
|
|
|
|
I have tried this also:
const char* chTemp = (const char*)sTemp.GetBuffer(0);
sTemp.ReleaseBuffer();
TRACE(">>>>>>>>>>>>>>>>>>>%s\n", chTemp);
the project is not multi-byte ... the same result, just one letter (first letter) from the string ...
|
|
|
|
|
_Flaviu wrote: the project is not multi-byte
Is it "not multi-byte" or "multi-byte"?
|
|
|
|
|
Sorry, is multi-byte .. .anyway, if the project is unicode or is multi-byte, is the same thing.
|
|
|
|
|
Try these tests:
CStringA ansiText("TestA");
LPCSTR ansi = (LPCSTR)ansiText;
TRACE("%s\n", ansi);
CString someText("Test");
ansi = (LPCSTR)someText;
TRACE("%s\n", ansi);
What is the result?
|
|
|
|
|
with the first try:
CStringA ansiText("TestA");
LPCSTR ansi = (LPCSTR)ansiText;
TRACE("%s\n", ansi);
the result is TestA
for the second try, I got an error:
1>d:\tempx\test\testdoc.cpp(53): error C2440: 'type cast' : cannot convert from 'CString' to 'LPCSTR'
at
CString someText("Test");
ansi = (LPCSTR)someText; TRACE("%s\n", ansi);
The project is unicode.
|
|
|
|
|
_Flaviu wrote: for the second try, I got an error:
1>d:\tempx\test\testdoc.cpp(53): error C2440: 'type cast' : cannot convert from 'CString' to 'LPCSTR'
at
CString someText("Test");
ansi = (LPCSTR)someText; TRACE("%s\n", ansi);
The project is unicode. |
Of course you get the error since the CString contains the wide char text!
Either change the build to be MBCS/ANSI or convert CString to wchar_t* (or use _T() macro).
|
|
|
|
|
"build to be MBCS/ANSI" you meant multi-byte project ?
|
|
|
|
|
Go to Project -> Properties -> General and make sure Character set is set to "Use Multi-Byte Charachter Set".
|
|
|
|
|
_Flaviu wrote:
TRACE(">>>>>>>>>>>>>>>>>>>%s\n", chTemp); What if you try:
TRACE(">>>>>>>>>>>>>>>>>>>%S\n", chTemp);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Is obviously something in project settings, because I have tried this code in a new test project and goes fine as multi-byte project ... as unicode, the same result.
|
|
|
|
|
You cannot cast a CStingW (which is what the class will be in a Unicode environment) to an LPCSTR (which is const char* ). You need to show again the actual failing code, and check the project settings.
|
|
|
|
|
In an array of strings I would like to get the string containing the most characters.
There are, of course, many ways to solve this, but coming from C# I find LINQ being an elegant tool.
I found out that the cpplinq NuGet package give me the same LINQ library as in C#.
For my problem - get the longest string in a string array - I can use the LINQ's aggregate function.
In C#, I have looked it up, and it can be solved like this:
using System;
using System.Linq;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var words = new string[] { "a", "bb", "ccc", "dddd" };
var longest = words.Aggregate("", (max, cur) => max.Length > cur.Length ? max: cur);
Console.WriteLine(longest);
}
}
} I cannot understand how to do this in C++ with the cpplinq package. Basically just porting the C#'s call to a C++'s call of the aggregate function.
#include "pch.h"
#include "cpplinq.hpp"
#include <iostream>
#include <string>
int main()
{
std::string words[4] = { "a", "bb", "ccc", "dddd" };
auto longest = "";
std::cout << longest << std::endl;
} I have googled for an example in c++ how to use the Aggregate function in cpplinq package, but with no result
Any suggestions?
|
|
|
|
|
I've just tried it out here and it seems easy enough:
using namespace cpplinq;
std::string words[4] = { "a", "bb", "ccc", "dddd" };
auto longest = from_array(words)
>> aggregate(std::string(), [](const std::string &m, const std::string &c) {
return m.length() > c.length() ? m : c; });
(I renamed the variables to "m" and "c" because I got an error message about max being a function.)
|
|
|
|
|
Thank you!
Man! I would have never guessed the porting would look like that 
|
|
|
|
|
I have an header file, where I have a function:
#ifdef __cplusplus
extern "C" {
#endif
....
struct_t* function_new(const struct_type_t* test);
...
#ifdef __cplusplus
}
#endif
for this function I get 2 links errors:
error LNK2019: unresolved external symbol _function_new referenced in function ....
now, in cpp file, of course that I have the body of this function, but is not recognized at all ... if this body function is written in cpp, or if I would delete the body of this function, the error is exactly the same ... strange, no ?
What could be the problem here, I am struggle to solve this error for days ...
|
|
|
|
|
For some reason the implementation file is not being built into your project. Once again we need more details in order to help you.
I would suggest that you move to using the Visual Studio IDE to build your projects as it is easier to see why problems like this occur, and you also get a standard structure for your projects.
|
|
|
|
|
The name function_new in your header file and the name _function_new reported by the linker do not match. Maybe the start of a track to explore here?
while (!(success = Try()));
|
|
|
|
|
The compiler adds the underscore at the beginning of function names in object files.
|
|
|
|
|
Some things that might have gone wrong:
1. You did not link the object file containing the implementation to your program.
Check your build options to make sure it's there.
2. The declaration in your header does not match your implementation.
Make sure there is no typo, the argument type and number matches, and ...
3. ... that it's compiled as C code. You mentioned a cpp file: if your compiler deducts how to compile a file by it's suffix, it may have compiled a C++ instead of a C function! In that case the linker won't find it. You could check your compiler's documentation for an option to force compilation as C. Alternately, just to find out you're on the right track, try removing 'extern "C"' in your header to find out whether that's actually the cause.
P.S.: Here's a good site pointing out all the details you need to watch out for when mixing C++ and C:
How to mix C and C++[^]
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
"2. The declaration in your header does not match your implementation.
Make sure there is no typo, the argument type and number matches, and ..."
That was the problem. Thank you all of you !
|
|
|
|