Andrew
?
Vlad
👍, how i can add pointer to this array ?
char temp; arr[0] = &temp;
MRT
char temp; arr[0] = &temp;
good, and now i want to add std::string to array
Vlad
good, and now i want to add std::string to array
You don't just add std::string to an array of pointers to char
MRT
You don't just add std::string to an array of pointers to char
std::string x = "Dd"; std::string yx = "xx"; char* strPointer[2];
MRT
Can i add x and yx variable to strPointer ?
MRT
char *yxstr = yx.c_str();
Vlad
char *yxstr = yx.c_str();
Good way to shoot yourself in the foot
Vlad
std::string x = "Dd"; std::string yx = "xx"; char* strPointer[2];
Consider this: std::string x = "Dd"; std::string yx = "xx"; std::vector<std::string> str_arr; str_arr.emplace_back(std::move(x)); str_arr.emplace_back(std::move(yx));
Andrew
Haha
Ανδρέας 🇮🇹
His PFP is so nice :3
sauce what series is she from?
𝚕𝚊𝚒𝚗𝚋𝚘𝚝.𝚜𝚌𝚖 🇺🇬
/get cbook
Anonymous
17-45-93-78-48-57-33-21-88-62-59-30-12-77-61 Show the numbers given above in the summary table (hash table) using the Quadratic Probing method. If there are, state the non-settled numbers.
Anonymous
Hello, please help me
Anonymous
17-45-93-78-48-57-33-21-88-62-59-30-12-77-61 Show the numbers given above in the summary table (hash table) using the Quadratic Probing method. If there are, state the non-settled numbers.
Show the code that you have implemented , and point out what's or where its wrong , if possible include the error message too.
Nils
/report
Anonymous
/report
Noooo
klimi
*sigh*
klimi
Anonymous
:(( ı m sorry
Anonymous
klimi
Help me
You can do it, klimi believes in you
Anonymous
:(( ı m sorry
Plz don't PM me.
Ανδρέας 🇮🇹
Anonymous
I M SORRY :(
Anonymous
I M SORRY :(
It clearly looks like you haven't read the rules , see pinned message.
Anonymous
I do not know english that well. I didn't have much time, please don't be sorry. Forgive me
Rocky
#include <stdio.h> #include <string.h> #include <stdlib.h> void xstrrev(char *a); int main() { int n; char str1[] = "To err is human..."; char str2[] = "But to really mess things up..."; char str3[] = "One needs to know C!!"; char *str[] = { str1, str2, str3}; for(n=0;n<=2;n++){ xstrrev(str[n]); printf("\n"); } } void xstrrev(char *a){ for(int n=(strlen( *str[n])-1);n>=0;n--) { printf("%c",*str[n]); } }
Nicola
Hi guys, sorry for the disturb, I have a little problem with assert();
Nicola
Can I post a code ? When I call a function controllaGenere(char* string); inside on assert, terminates without returning the indicated value and without printing the printf entered in the console
Nicola
yes
𝐄𝐲𝐚𝐝
Hi Im coding with c++ using Code::Blocks and I want to use SFML and it shows me this error when I build the project
𝐄𝐲𝐚𝐝
cannot find -lsfml-graphics cannot find -lsfml-audio -- -lsfml-window
𝐄𝐲𝐚𝐝
What can I do
Pavel
cannot find -lsfml-graphics cannot find -lsfml-audio -- -lsfml-window
It can't find the libraries, SFML is a library that used by many people, so usually you can google these errors and find a solution for your OS (because many people faced that issue already)
𝐄𝐲𝐚𝐝
Windows
Pavel
Windows
Do you have these libraries downloaded or built?
klimi
Thank you good man
Pavel
Thank you good man
No need to thanks :)
Pavel
Windows
I'm not sure about sfml + windows, but you usually need to have these libs available in some folder (that you can specify) so they can be linked. They are either *.lib or *.a as far as I remember (depends on the compiler)
Pavel
But here my knowledge ends, I usually configure all that stuff once via cmake and then forget forever 😅
𝐄𝐲𝐚𝐝
Do you have these libraries downloaded or built?
Looks like the Cmake didn't do its job
𝐄𝐲𝐚𝐝
any way to build libs without cmake ?
𝐄𝐲𝐚𝐝
libraries
Ihor
Does anybody know some literature about Information and Coding Theory ?
Anonymous
Does anybody know some literature about Information and Coding Theory ?
Probably not, but you could look up lecture notes from other courses... https://ttic.uchicago.edu/~madhurt/courses/infotheory2014/index.html I couldn't explain to you what any of those mean!
Anonymous
anybody familiar with ALPR or opencv :) plz can i use OpenALPR offline ?
Kanni
Hello guys
Kanni
Please I need help with this ......"Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when a terminating '|' is entered."
MRT
hiiiiiiii
MRT
i declare class with : A* a = new A()
MRT
how i can delete memory in destructor of class ?
MRT
delete this ?
Kanni
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main() { int input; int size = 0; vector<int> input_box; while (cin >> input) input_box.push_back(input); int a = 0; int b = 2; while (size < input_box.size()) for (int i = a; i < b; i++) { cout << input_box[i] << " "; a = b; b += 2; size++; } return 0; }
Vlad
delete this ?
No. You don't delete this
Vlad
Unless you really know what you're doing and why
Vlad
i declare class with : A* a = new A()
Chances are you don't need to allocate it on the heap
Anonymous
Please I need help with this ......"Write a program that consists of a while-loop that (each time around the loop) reads in two ints and then prints them. Exit the program when a terminating '|' is entered."
Consider using the ungetc() function. while(1) { char check; scanf(" %c", &check); if(check == '|') break; else ungetc(check, stdin); /* ... */ } That loop will still not work if anything besides a number/whitespace/pipe-char comes in.
Bhaskar
How to get in touch with the admin here?
Igor🇺🇦
i declare class with : A* a = new A()
Who will call this destructor?
MRT
Who will call this destructor?
function, inside class
MRT
Who will call this destructor?
i create class bassed thread, i want thread cancel and class be destroyed
MRT
i create class bassed thread, i want thread cancel and class be destroyed
//class class HandShakeThreadClass { public: HandShakeThreadClass(SOCKET sock) : sock(sock) { _data = ""; StartInternalThread(); } ~HandShakeThreadClass() { closesocket(sock); pthread_cancel(_thread); (void)pthread_join(_thread, NULL); return; } /** Returns true if the thread was successfully started, false if there was an error starting the thread */ bool StartInternalThread() { return (pthread_create(&_thread, NULL, InternalThreadEntryFunc, this) == 0); } protected: virtual void InternalThreadEntry() { int buffLength = 512; std::vector<char> buffer(buffLength); int socket_res; bool is_active = true; // u_long iMode = 1; ! //ioctlsocket(sock, FIONBIO, &iMode);//set client socket to none blocking int ReceiveTimeout = 5000; setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&ReceiveTimeout, sizeof(ReceiveTimeout)); do { printf("Repeat socket recv \n"); socket_res = recv(sock, &buffer[0], buffer.size(), 0); if (socket_res == SOCKET_ERROR) { // is_active = false; continue; } else { // } continue; } while (is_active); // i want to cancle thread and delete this class ! this->~HandShakeThreadClass(); return; }; private: static void* InternalThreadEntryFunc(void* This) { ((HandShakeThreadClass*)This)->InternalThreadEntry(); return NULL; } pthread_t _thread; }; #endif
MRT
i declare this class in while , in socket programming with HandShakeThreadClass* _handShakeThread = new HandShakeThreadClass(ClientSocket);
Pavel
//class class HandShakeThreadClass { public: HandShakeThreadClass(SOCKET sock) : sock(sock) { _data = ""; StartInternalThread(); } ~HandShakeThreadClass() { closesocket(sock); pthread_cancel(_thread); (void)pthread_join(_thread, NULL); return; } /** Returns true if the thread was successfully started, false if there was an error starting the thread */ bool StartInternalThread() { return (pthread_create(&_thread, NULL, InternalThreadEntryFunc, this) == 0); } protected: virtual void InternalThreadEntry() { int buffLength = 512; std::vector<char> buffer(buffLength); int socket_res; bool is_active = true; // u_long iMode = 1; ! //ioctlsocket(sock, FIONBIO, &iMode);//set client socket to none blocking int ReceiveTimeout = 5000; setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&ReceiveTimeout, sizeof(ReceiveTimeout)); do { printf("Repeat socket recv \n"); socket_res = recv(sock, &buffer[0], buffer.size(), 0); if (socket_res == SOCKET_ERROR) { // is_active = false; continue; } else { // } continue; } while (is_active); // i want to cancle thread and delete this class ! this->~HandShakeThreadClass(); return; }; private: static void* InternalThreadEntryFunc(void* This) { ((HandShakeThreadClass*)This)->InternalThreadEntry(); return NULL; } pthread_t _thread; }; #endif
You shouldn't call destructor like this from the class method. Also, the only case when you need to call destructor explicitly is if you constructed the object with placement new (or if plan to reconstruct it with placement new, probably also a valid case)