Pavel
it is from a program
Well, then I would check if you: - have correct input string - have correct key - using correct algorithm (e.g. maybe you were supposed to skip the plus)
/
Well, then I would check if you: - have correct input string - have correct key - using correct algorithm (e.g. maybe you were supposed to skip the plus)
qmemcpy(v17, "+Hogqi&fjbj![xcwrp1Cy{xo|ti[gCDRWMJHoIGNldp8-S", sizeof(v17)); while ( v12 != 46 ) { sub_AA90(v12 + 46, v11); v17[v12++] ^= v13; }
Дон
Yes
What could be the possible reasons why the normal int function is not used instead? And that instance will have value 0
Pavel
What could be the possible reasons why the normal int function is not used instead? And that instance will have value 0
Enum is more verbose about meaning of the value, so it's difficult to make a mistake and return blue meaning red
Pavel
What could be the possible reasons why the normal int function is not used instead? And that instance will have value 0
Also in C++ if you use enum class it will disallow to accidentally pass the resulting value to something incompatible, which happens very often, eg. you have different ways to encode color using ints (enumeration, rgba, argb, etc) and you can accidentally pass wrongly encoded color if all the colors are just ints
olli
Process returned -1073741819 (0xC0000005)
Access Violation C0000005 your string literal is read only and can't be changed. // string literal that can't be changed char * s1 = "Hello"; // modifiable string char s2[] = "Hello";
Map
Any help on how to make security app ?
GANESH
Basic languages
Pavel
But i know it should be const to not be changed
^= operator changes it https://wandbox.org/permlink/8plEruN7N9uP548I
Anonymous
Hi ✋ I have a solution for my answer, but this way I assume is worst practice :) is there any way that I can create a class with variable size ? And enable or disable member variable of class ? Like in this code : https://godbolt.org/z/csqdebc8s
There are alternatives like base classes with template trickery which are just as bad as this. You should be asking why you need this and if instead you should go for a better design.
Anonymous
But i know it should be const to not be changed
Well you have initialised it with a char* pointer and not a const char* pointer. There is nothing that tells the compiler that the pointed to string cannot be changed resulting in Undefined Behavior.
Ly Sophavin
how to write c++ function find longest word
Ly Sophavin
thank you
HENIL
#include <stdio.h> #include <math.h> double add(double x,double y){ return x+y; } int main(){ double x , y, result; printf("Enter two numbers : "); scanf("%lf %lf",x ,y); result = add(x, y); printf("%lf",result); return 0; }
HENIL
Cant run this code. What's the mistake ?
HENIL
checked, not having issue with it
HENIL
When i enter 2 numbers, the .exe file stops working
Dima
checked, not having issue with it
issue is related to scanf
Dima
try to google the examples, you’ll find the error
Dima
its easy
Anonymous
Server::Server( char letterName) : name(letterName) { /*Intentionally empty*/} is there anyone who knows anything about ": name(letterName)"? the relevant class is like the following class Server { public: Server( char letterName); static int getTurn( ); void serveOne( ); static bool stillOpen( ); private: static int turn; static int lastServed; static bool nowOpen; char name; };
Emre Atakuru
#include <stdio.h> #include <math.h> double add(double x,double y){ return x+y; } int main(){ double x , y, result; printf("Enter two numbers : "); scanf("%lf %lf",x ,y); result = add(x, y); printf("%lf",result); return 0; }
Scanf function waits the address of variables but you didn't pass. you should use &x , &y that gives the address of variables to scanf function. You should change scanf("%lf %lf" , x , y); with scanf("%lf %lf" , &x , &y)
...
https://stackoverflow.com/questions/471432/in-which-scenario-do-i-use-a-particular-stl-container/22671607#22671607
klimi
Hello, I am desiring to load 2 files into std::string. I am currently using one std::ifstream and one std::stringstream but to clear the stringstream i am using stream.str( std::string() ); stream.clear(); but since i am resetting it, that means i can move the std::string and that should clean the str so i wouldn't have to do the stream.str(std::string()); line. But when i actually try doing source1 = std::move(stream).str(); Then i see the content in the stream in the second str call anyway, am I overlooking something? thanks
Pavel
Hello, I am desiring to load 2 files into std::string. I am currently using one std::ifstream and one std::stringstream but to clear the stringstream i am using stream.str( std::string() ); stream.clear(); but since i am resetting it, that means i can move the std::string and that should clean the str so i wouldn't have to do the stream.str(std::string()); line. But when i actually try doing source1 = std::move(stream).str(); Then i see the content in the stream in the second str call anyway, am I overlooking something? thanks
Calling move doesn't guarantee that actual move will happen, it just transforms the reference type, so imagine your code as something like static_cast<stream_type&&>(stream).str(); So if str.() doesn't have overload for rvalue ref, which is rarely a case for a member function, then it will just call the function as if there were no std::move invoked
Pavel
At least I think that's what happening here
klimi
Calling move doesn't guarantee that actual move will happen, it just transforms the reference type, so imagine your code as something like static_cast<stream_type&&>(stream).str(); So if str.() doesn't have overload for rvalue ref, which is rarely a case for a member function, then it will just call the function as if there were no std::move invoked
Well i thought it will call void str( std::basic_string<CharT,Traits,Allocator>&& s ); (6) (since C++20) which has note: 6) Replaces the contents of the underlying string. Equivalent to rdbuf()->str(std::move(s));. But just now How i am looking i see that that is a void... so i misread the signature...
klimi
Well but at least this should get called no? std::basic_string<CharT,Traits,Allocator> str() &&; 3) Returns a string move-constructed from the underlying string. Equivalent to return std::move(*rdbuf()).str();.
klimi
ah ok, so there is an overload
https://en.cppreference.com/w/cpp/io/basic_stringstream/str
klimi
i hope, i am trying to compile it with cmake so i use set(CXX_STANDARD 20)
Pavel
i hope, i am trying to compile it with cmake so i use set(CXX_STANDARD 20)
🤔 C++20 https://wandbox.org/permlink/Pb2fieA3vx9y7f9o C++17 https://wandbox.org/permlink/swwI1drpr84Xt79R
Pavel
Not reeeally reliable code, I would say
Pavel
Even though it's probably guaranteed after C++20
Pavel
probably also set(CMAKE_CXX_STANDARD_REQUIRED ON)
klimi
try set(CMAKE_CXX_STANDARD 20)
just this does the trick... damn i feel stupid :D
Pavel
just this does the trick... damn i feel stupid :D
The one you used is set up per target https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD
novice
just want to ask that , if its ok for a beginner in coding ( c lang) to join this grp , i read about this grp somewhere on net so is it ok if i ask some silly questions related to c lang?
/
help
/
how i make a string char *string = "string"; non const
Aquatica
help
I'm calling 911, stay there
/
help
Natanim
I'm trying to connect my database with my c++ code and while im installing the necessary files, it requirs me to install the "libmysql.a" file, but i couldn't find it anywhere online. Is it the same as "libmysql.dll"?
Dm
memcpy it to a char array
strcpy also should works
Pavel
strcpy also should works
Right, forgot about that one
Prinzkyd
help
i dont really get your question
olli
how i make a string char *string = "string"; non const
I guess the easiest way would be char string[] = "hello";
Dev.🐍
Hi I gonna read file and write the file with another language. What do i do?
Hussein
Hi I gonna read file and write the file with another language. What do i do?
you can do this with a regular file IO just use read() and write() with open() or it’s equivalant in your programming language
Hussein
Hi I gonna read file and write the file with another language. What do i do?
but if you were trying to communicate between a two programs written with two programming languages ,then using interprocess communication or udp sockets in address 127.0.0.1 is better
Hussein
I looking for way that python understand fortmat binary file and write file.
read it as bytes with open(“filename”,”rb”)
Hussein
a byte array in python is a C string
this is why when programming with sockets you have to encode your string into bytes because the operating system library is written in C
Dev.🐍
I tried but it didn't work