Related
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
Neil Kirk I want to pass char to a parameter that expects a string. void test(const string&);
test('a'); // does not like
error: invalid user-defined conversion from ‘char’ to ‘const string& {aka const std::basic_string<char>&}’ I know I can change 'to', but
Abruzzo Forte and Gentile This is a newbie question, but I don't understand how it works. Suppose I have the following function void foo(const std::string& v) {
cout << v << endl;
}
and the call in my program below. foo("hi!");
Essentially, I'm passing a
Nikhil Padmanabhan Suppose I have church strings var s : string;
How can I send it to the expected function char*( c_stringhypothetically const char *)? mppf Here is an example of doing so extern {
#include <stdio.h>
static void f(char* argument) {
pr
Nikhil Padmanabhan Suppose I have church strings var s : string;
How can I send it to the expected function char*( c_stringhypothetically const char *)? mppf Here is an example of doing so extern {
#include <stdio.h>
static void f(char* argument) {
pr
Bronn A note in advance : I know it's not a good idea to do what I'm asking for here. It's just a matter of curiosity about morbid language, not actual use. The rules I apply here are completely arbitrary. Suppose we have a function fully defined as follows. I
Mazander I want to build a .so C++ library and link to OpenCV using Visual Studio. (My goal is to make an apk that uses .so files in Unity) I created a cross platform dynamic shared library project in Visual Studio and set the appropriate project settings. In
Mazander I want to build a .so C++ library and link to OpenCV using Visual Studio. (My goal is to make an apk that uses .so files in Unity) I created a cross platform dynamic shared library project in Visual Studio and set the appropriate project settings. In
Mazander I want to build a .so C++ library and link to OpenCV using Visual Studio. (My goal is to make an apk that uses .so files in Unity) I created a cross platform dynamic shared library project in Visual Studio and set the appropriate project settings. In
Martin Perry if i use const char * str = "Hello";
No memory allocation/deallocation required at runtime if i use const std::string str = "Hello";
Will allocation be done in the string class via new/malloc? I can find it in assembly, but I'm not very good at
Martin Perry if i use const char * str = "Hello";
No memory allocation/deallocation required at runtime if i use const std::string str = "Hello";
Will allocation be done in string class via new/malloc? I can find it in assembly, but I'm not very good at read
Martin Perry if i use const char * str = "Hello";
No memory allocation/deallocation required at runtime if i use const std::string str = "Hello";
Will allocation be done in the string class via new/malloc? I can find it in assembly, but I'm not very good at
Martin Perry if i use const char * str = "Hello";
No memory allocation/deallocation required at runtime if i use const std::string str = "Hello";
Will allocation be done in string class via new/malloc? I can find it in assembly, but I'm not very good at read
Martin Perry if i use const char * str = "Hello";
No memory allocation/deallocation required at runtime if i use const std::string str = "Hello";
Will allocation be done in the string class via new/malloc? I can find it in assembly, but I'm not very good at
Lemon Candy There is a function that takes a const char* array, basically a list of words. Since this list of words may change, I cannot declare and initialize this array at program startup. Now, I have a vector of strings that I need to convert to a const cha
Lemon Candy There is a function that takes a const char* array, basically a list of words. Since this list of words may change, I cannot declare and initialize this array at program startup. Now, I have a vector of strings that I need to convert to a const cha
gap Typically string_viewused for the following function parameters: void fval(std::string_view sv);
void fcref(std::string_view const &sv);
Which is better? A const reference is 8 bytes, string_viewusually twice that, say 16 bytes. However, if not inlined or
gap Typically string_viewused for the following function parameters: void fval(std::string_view sv);
void fcref(std::string_view const &sv);
Which is better? A const reference is 8 bytes, string_viewusually twice that, say 16 bytes. However, if not inlined or
gap Typically string_viewused for the following function parameters: void fval(std::string_view sv);
void fcref(std::string_view const &sv);
Which is better? A const reference is 8 bytes, string_viewusually twice that, say 16 bytes. However, if not inlined or
gap Typically string_viewused for the following function parameters: void fval(std::string_view sv);
void fcref(std::string_view const &sv);
Which is better? A const reference is 8 bytes, string_viewusually twice that, say 16 bytes. However, if not inlined or
gap Typically string_viewused for the following function parameters: void fval(std::string_view sv);
void fcref(std::string_view const &sv);
Which is better? A const reference is 8 bytes, string_viewusually twice that, say 16 bytes. However, if not inlined or
Zulukas I am trying to call this method #define SIZE 16
void DoSomething(char(&value)[SIZE])
{
}
By this method: void BeforeDoingSomething(char* value, int len)
{
if (len == SIZE)
{
DoSomething(value);
}
}
Trying to do this gives me this
Zulukas I am trying to call this method #define SIZE 16
void DoSomething(char(&value)[SIZE])
{
}
By this method: void BeforeDoingSomething(char* value, int len)
{
if (len == SIZE)
{
DoSomething(value);
}
}
Trying to do this gives me this
Zulukas I am trying to call this method #define SIZE 16
void DoSomething(char(&value)[SIZE])
{
}
By this method: void BeforeDoingSomething(char* value, int len)
{
if (len == SIZE)
{
DoSomething(value);
}
}
Trying to do this gives me this
User 13851309 Here is my code. int main(int argc, char *argv[]) {
int shmid;
char *shmc;
char *shmp;
pid_t pid;
shmid = shmget(IPC_PRIVATE, 3 * sizeof(char), 0666 | IPC_CREAT);
pid = fork();
if (pid == 0) {
shmc = (c
mr_js In the microcontroller's ISR, I'm trying to call a function like this: //adc.c
static volatile char uartBuf[6]={0};
CY_ISR(ISR_ADC)
{
for (uint8_t i=0; i < NS; i++)
total += adc2_buffer0[i];
uartBuf[0] = total >> 24 & 0xFF;
uartBuf[1] = total >> 16
username Say I have some utf8 encoded strings. In it, use to separate words ";". But every character (except ) in ";"this string has a utf8 value greater than 128 . Suppose I store this string in unsigned charan array: unsigned char buff[]="someutf8string;sepa