Related
Denis Kreshchen I have shaders stored in String values: var myShader =
" attribute vec4 a_position;" +
" void main() {" +
" gl_Position = a_position;" +
" }"
glShaderSource(shader, GLsizei(1), myShader, nil)
The function
good man I have the following code. const char* my_input = "my string";
void my_function(char* my_argument);
int main()
{
my_function(my_input);
}
void my_function(char* my_argument)
{
/* Do something */
}
Note that the argument to my_function expects
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
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
Denis Kreshchen I have shaders stored in String values: var myShader =
" attribute vec4 a_position;" +
" void main() {" +
" gl_Position = a_position;" +
" }"
glShaderSource(shader, GLsizei(1), myShader, nil)
The function
user I have the following standard working code :C++ 17 template< int PathIndex, int PathLength, const char (path)[PathLength] >
constexpr const int findlastslash()
{
if constexpr( PathIndex < 1 || path[PathIndex] == '/' || path[PathIndex] == '\\' ) {
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
Ben When interacting with a C api in Swift (SQLite 3 C api), I need to pass a pointer to a pointer to a const char as an output parameter: sqlite3_prepare_v2(
// snip other parameters
const char **pzTail // OUT parameter
);
Translate it to Swift: sqlite3_prep
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
good man I have the following code. const char* my_input = "my string";
void my_function(char* my_argument);
int main()
{
my_function(my_input);
}
void my_function(char* my_argument)
{
/* Do something */
}
Note that the argument to my_function expects
Denis Kreshchen I have shaders stored in String values: var myShader =
" attribute vec4 a_position;" +
" void main() {" +
" gl_Position = a_position;" +
" }"
glShaderSource(shader, GLsizei(1), myShader, nil)
The function
Ben I have the following: int main(int argc, char *argv[])
{
char *INPUTFILE_DATABASE = "";
strcpy(INPUTFILE_DATABASE, argv[1]);
if(INPUTFILE_DATABASE[0]=='\0')
{
cout << "No input file given" << endl;
INPUTFILE_DATABASE
good man I have the following code. const char* my_input = "my string";
void my_function(char* my_argument);
int main()
{
my_function(my_input);
}
void my_function(char* my_argument)
{
/* Do something */
}
Note that the argument to my_function expects
Bisla It's easy to see the tasks to be done here. Read a list of files and pass it to another function. Why doesn't this work. When I try to store the filename in a local char** it works fine, but I can't send it back via a pointer. gives segmentation fault. i
Naveen kumar Katta rathanaiah Please help me to convert the following line of C++ code to ctypes python: Ret = openFcn(&Handle, "C:\\Config.xml");
Here are the declarations for each: typedef uint16_t (* OpenDLLFcnP)(void **, const char *);
OpenDLLFcnP openFcn
user I have the following standard working code :C++ 17 template< int PathIndex, int PathLength, const char (path)[PathLength] >
constexpr const int findlastslash()
{
if constexpr( PathIndex < 1 || path[PathIndex] == '/' || path[PathIndex] == '\\' ) {
Wisviva Lets say I have a template: template<char const *str>
class Template { ... };
Why can't the following be written? Template<"literal"> T;
or char const *s = "Literal";
Template<s> T;
Why does the following approach work? char const s[] = "Literal";
T
user I have the following standard working code :C++ 17 template< int PathIndex, int PathLength, const char (path)[PathLength] >
constexpr const int findlastslash()
{
if constexpr( PathIndex < 1 || path[PathIndex] == '/' || path[PathIndex] == '\\' ) {
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
Denis Kreshchen I have shaders stored in String values: var myShader =
" attribute vec4 a_position;" +
" void main() {" +
" gl_Position = a_position;" +
" }"
glShaderSource(shader, GLsizei(1), myShader, nil)
The function
good man I have the following code. const char* my_input = "my string";
void my_function(char* my_argument);
int main()
{
my_function(my_input);
}
void my_function(char* my_argument)
{
/* Do something */
}
Note that the argument to my_function expects
good man I have the following code. const char* my_input = "my string";
void my_function(char* my_argument);
int main()
{
my_function(my_input);
}
void my_function(char* my_argument)
{
/* Do something */
}
Note that the argument to my_function expects
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
Gábor Marschall I want to use this function to call the PlaySoundA function, but the sound file I want to play doesn't open. void AudioClass::playAudio(const char* incomingData, const char* filePath)
{
char buffer[100]; // <- danger, only storage for 100
user I have the following standard working code :C++ 17 template< int PathIndex, int PathLength, const char (path)[PathLength] >
constexpr const int findlastslash()
{
if constexpr( PathIndex < 1 || path[PathIndex] == '/' || path[PathIndex] == '\\' ) {
user I have the following standard working code :C++ 17 template< int PathIndex, int PathLength, const char (path)[PathLength] >
constexpr const int findlastslash()
{
if constexpr( PathIndex < 1 || path[PathIndex] == '/' || path[PathIndex] == '\\' ) {
Bisla It's easy to see the tasks to be done here. Read a list of files and pass it to another function. Why doesn't this work. When I try to store the filename in a local char** it works fine, but I can't send it back via a pointer. gives segmentation fault. i