Anonymous
I understand, yes. There should be a number in parentheses, but I need argv [1], but argv [1] doesn't work. This is the problem
You need to pass in command line arguments to populate argv. For ex if your executable is named genpasswd, then you should execute it like ./genpasswd <arguments>
Pavel
I understand, yes. There should be a number in parentheses, but I need argv [1], but argv [1] doesn't work. This is the problem
You can convert it to int, and pass the int to the function. There are multiple ways to convert string to an int, you can find some here: https://stackoverflow.com/questions/2237980/how-do-i-convert-a-char-to-an-int
der ðiβüśüɾę
Anonymous
K
Hey guys 👋🏻
matt
Guys, I have one more thing to ask. pthread_mutex_unlock() from what I have seen from the manpage cannot be called from another thread, right?
Anonymous
Guys, I have one more thing to ask. pthread_mutex_unlock() from what I have seen from the manpage cannot be called from another thread, right?
No. The thread that locked the mutex must call unlock. Even if this mutex were an inter process mutex, you would still have to unlock it from within the same thread that locked it
matt
No. The thread that locked the mutex must call unlock. Even if this mutex were an inter process mutex, you would still have to unlock it from within the same thread that locked it
I have this program (https://pastebin.com/ANnNgj1T ) where it is called within the thread, despite being called pthread_mutex_lock() in the main thread. This is possible?
matt
It is Undefined Behavior to call unlock from a thread that has not locked the mutex.
As I imagined. Can you tell me why it is used in the case of this program?
Anonymous
As I imagined. Can you tell me why it is used in the case of this program?
I really don't have the time to go through that huge chunk of code. Maybe it was a mistake.
matt
I really don't have the time to go through that huge chunk of code. Maybe it was a mistake.
Maybe ... I'll try to understand more fully the reason for its use in this case. Thanks anyway for your patience and your help
RANGER
how char getter can be create in MS visual studio?
RANGER
class Event { private: int eventID; char eventType[20]; char themeColor[20]; char location[20]; public: void setEventDetails(int pEID, char const pEType[], char const pTcolor[],char const pLoc[]); void displayEventDetails(); void setEventLocation(char const pNewLoc[]); _ getEventLocation(); };
ꍏꈤꀸ
Hi, I have a string like "2|4" and i expect that first parameter ("2") is uint32_t and second ("4") is uint64_t. How can i verify that data in string is of expected type?
Pavel
Hi, I have a string like "2|4" and i expect that first parameter ("2") is uint32_t and second ("4") is uint64_t. How can i verify that data in string is of expected type?
There are no "types" for numbers inside string, what you can do is try to verify that the number not bigger than the maximum number that can fit into your types (and also check that it contains only digits). Here you can find some suggestions: https://stackoverflow.com/questions/19621737/how-can-i-check-integer-overflow-in-c-c
Anonymous
#include<stdio.h> int main () { int Temp; float co=1.8; int C=32; printf("Enter the Temperatue in Celcius \n"); scanf("%d \n", &Temp); printf("Temperature in Faranheit %f \n ", co*Temp+C); return 0; }
Anonymous
Don't understand what is wrong with this code...
Stay Forward
YVEF
Hi. If someone use Windows. Please can you check CorProf.h header from windows library. if you added this header to your project, your build will fail because some definition in this header hidden by directive #if 0. so, my question, what is the best way to work with it? because change windows header file is at least strange for me. thanks
YVEF
include guards” in a header file. Always ..
what are you mean? #include "corprof.h" ?? so how it can help me?))
YVEF
are you using the latest windows 10 sdk?
corprof.h comes from .net sdk
Anonymous
corprof.h comes from .net sdk
well, are you using the latest .NET SDK?
Anonymous
it might be a bug
Anonymous
why would you have code necessary for compilation behind a #if 0
YVEF
well, are you using the latest .NET SDK?
it swaned by dotnet runtime team :) it's not a bug. because the header is corrupted because of it. some definitions is missing. you can check it just create empty project and add the header to your any file
Aniket
Can anybody please help me how to store a name in a dynamically allocated charcter buffer and print it.
Aniket
Bro actually I want this with the help of dynamic memory allocation
GodXAnubis
I learned C/C++ recently what should i do now
GodXAnubis
Books
Anonymous
Waiting to hear how u did it..
Anonymous
The C±± language is different..
abbdullah
#include <stdio.h> #include<string.h> int main() { char s[100]; int n; scanf("%s",s); n=strlen(s); if(s[0]==0 && s[n]==1) { printf("0"); } for(int i=0; i<n; i++) { if(s[0]==1 && s[n-i]==1) { printf("%d",n-i-1); break; } } return 0; }
abbdullah
If Ip 1001001010 Op 7 Explanation Want to print digits between 1 at 0th index & last one. Ip 010101 Op 0 Explanation 0th index 0 & last index 1 op 0
ARx
hi, i've been learning c from kernighan and ritchie c programming, and i'd like to know what graphics API do you recommend to start learning, and if it's too much change from C to C++ to develop game
abbdullah
Plzz anyone....Help me to rectify my logical error in coding
YUSUF
I learned C/C++ recently what should i do now
Learn extra library that helps you to create what you want Such as sfml, sdl, ffmpeg, opencv, opengl...etc
YUSUF
Things depends in which field you want to go
YUSUF
😊
Emre Atakuru
hi, i've been learning c from kernighan and ritchie c programming, and i'd like to know what graphics API do you recommend to start learning, and if it's too much change from C to C++ to develop game
İf you want to graphic C++ better than C so learn C++. Both languages has some similar thing but definetly different. C++ is more complicated.
Sabmakovic
Learn extra library that helps you to create what you want Such as sfml, sdl, ffmpeg, opencv, opengl...etc
Please If I want to learn how to develop a AppRTC using C programing which book can you recommend me
Suka
hi, i've been learning c from kernighan and ritchie c programming, and i'd like to know what graphics API do you recommend to start learning, and if it's too much change from C to C++ to develop game
for c++ try qt for modern looks desktop app and they have gui builder which help alot, fltk for simplicity or imgui for bloat free. and for c idk ig writing gui in c need alot of works hehe. so usually i use cpp for gui and c as module/library. cmiiw
Disha
#include<stdio.h> int main() { char ch; int a[50],c=0,n; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%c",&a[i]); if(a[i]=='a''e''i''o''u' && a[i]=='A''E''I''O''U') c++; } printf("Count:%d",c); return 0; }
Disha
.whats the problem plz tell me
Disha
i dont understand
Anonymous
Why do bitwise operators require parentheses when printing with cout? Like cout << (3 & 6);
Steven
wow you are here
Anonymous
@SilhouetteInDark @o0_0b So the program tries to leftshift the cout object by 3 bits and then & the result with 6, right? My question is, why doesn't it affect cout when used with a single integer? If we use cout << 5, why doesn't it try to leftshift cout by five bits?
Steven
because ostream provides an overload for operator<<
Anonymous
because ostream provides an overload for operator<<
So when we do cout << 3&6, is << interpreted as the leftshift operator or is the overloaded version used?
Anonymous
@SilhouetteInDark @o0_0b So the program tries to leftshift the cout object by 3 bits and then & the result with 6, right? My question is, why doesn't it affect cout when used with a single integer? If we use cout << 5, why doesn't it try to leftshift cout by five bits?
No. << Is an overloaded operator that writes to the output stream. cout << 5 & 6 is interpreted as (cout << 5) & 6 because operator<< has higher precdence than operator&. So the meaning of this statement is interpreted as 5 is first written to the outputstream. operator<< for ostream returns ostream&. So cout is returned as the result of cout << 5. Now you try to "bitwise and" cout with 6 which is meaningless and will be flagged as a compiler error
Anonymous
Yes
Nice. Thanks
Anonymous
Anonymous
Knowing when the compiler generated constructors, destructors and assignment operators are implicitly defined.
Naina
What does copy assignment && move constructor && move assignement mean here ?? Can someone plz give a brief explanation about them and what this table basically denotes ...
ꍏꈤꀸ
Hey, I have two strings, the first is the data "1 | 2 | 3", the second is the types I expect "int | uint32_t | uint64_t". I need to convert this data to the appropriate types and substitute it as parameters in a function. How to achieve this in C ++ 11?