Anonymous
Hi i wanna create process and thread by pure C code and dont use windows API or posix standard , can you introduce article(s) about it. Thanks for your help
Anonymous
Hi i wanna create process and thread by pure C code and dont use windows API or posix standard , can you introduce article(s) about it. Thanks for your help
You can't. The C standard doesn't deal with processes. So you will have to take help from the underlying OS and the API they provide for doing so which is what you don't want to use.
Ammar
You can't. The C standard doesn't deal with processes. So you will have to take help from the underlying OS and the API they provide for doing so which is what you don't want to use.
Yeah, that's right, but at least they don't want to use POSIX standard API and Windows. So Linux specific will be the answer, lol. Not sure what is their goal though.
Anonymous
See: man 2 clone It's Linux specific.
Thanks but linux is under posix :|
Ammar
Try to open the man page and type /CONFORMING TO
Ammar
Thanks but linux is under posix :|
So, what exactly do you want? Can you tell what is your goal?
Anonymous
So, what exactly do you want? Can you tell what is your goal?
I don't have exact purpose , may be learning and implementation 🙂
Ammar
I don't have exact purpose , may be learning and implementation 🙂
Processes are handled by the OS, so the low level detail of it is OS specific. man 2 clone is the example for Linux to deal with them.
Ammar
If you don't want to use the libc API wrapper for that clone(2), you can craft your own syscall code for arch specific with inline Assembly in your C code.
saa~
Izin bertanya ini,caranya bagaimana ya supaya tidak eror? #include<iostream> #include<conio.h> using namespace std; int main (); { char a, b, c = 0, d = 0, e = 0, f = 0 : //Deklarasi cout<<"masukkan nilai A :"; cin>>A; cout<<"masukkan nilai B :"; cin>>b; c = a * b: d = a \ B; e = a + b; f = a - b; cout<<"\nHasil dari C = A * B ="<<c<<end1; cout<<"Hasil dari C = A / B ="<<D<<end1; cout>>"Hasil dari C = A + B ="<<e<<end1; cout<<"Hasil dari C = A - B =">>F<<end1; getch(); }
Dima
english only
Captain
english only
I know i just replied in sarcastic way😁
D
guys follow the rules cause in other case mess is creating
Dima
/ban 2001864576 go fuck yorself
Anonymous
anyone who wanna help me java, im stuck with this code https://pastebin.com/b1srFHkb
Anonymous
Most distributions are POSIX compliant but are not certified because they don’t want to pay the extra fee to get certified
Anonymous
You should use POSIX api to make your applications portable most Linux distributions have extra api features so you can also use this at the risk of portability
Anonymous
/get cbook
Anonymous
Anyone good in C or java or c++ or python language Pls msg me urgently
olli
Anyone good in C or java or c++ or python language Pls msg me urgently
Feel free to ask your C/C++ related questions here.
Apk
Coding
yeah ask your question
Anshul
================================================================= ==31==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000002f4 at pc 0x000000345a20 bp 0x7ffe06583de0 sp 0x7ffe06583dd8 READ of size 4 at 0x6020000002f4 thread T0 #2 0x7f089b6d10b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) 0x6020000002f4 is located 0 bytes to the right of 4-byte region [0x6020000002f0,0x6020000002f4) allocated by thread T0 here: #6 0x7f089b6d10b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) Shadow bytes around the buggy address: 0x0c047fff8000: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8010: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8020: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fd 0x0c047fff8030: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8040: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa =>0x0c047fff8050: fa fa fd fa fa fa fd fa fa fa fd fa fa fa[04]fa 0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==31==ABORTING
Anshul
after submission on leetcode, i got this error. i don't know the reason for it. can anyone help me
Dr
I guess you utilized some more than allocated memory for your program👀
Anshul
class Solution { public: void nextPermutation(vector<int>& nums) { int n=nums.size(); int i=n-1; for(;i>=0;i--) { if(nums[i]<nums[i+1]) { break; } } if(i<0) { //elements are in descending order reverse(nums.begin(),nums.end()); return; } int j=n-1; for(;j>i;j--) { if(nums[j]>nums[i]) { break; } } swap(nums[j],nums[i]); return; } };
Anshul
this is the code. i'm using no extra space
Jasur Fozilov 🐳
================================================================= ==31==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000002f4 at pc 0x000000345a20 bp 0x7ffe06583de0 sp 0x7ffe06583dd8 READ of size 4 at 0x6020000002f4 thread T0 #2 0x7f089b6d10b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) 0x6020000002f4 is located 0 bytes to the right of 4-byte region [0x6020000002f0,0x6020000002f4) allocated by thread T0 here: #6 0x7f089b6d10b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) Shadow bytes around the buggy address: 0x0c047fff8000: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8010: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8020: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fd 0x0c047fff8030: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8040: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa =>0x0c047fff8050: fa fa fd fa fa fa fd fa fa fa fd fa fa fa[04]fa 0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==31==ABORTING
leetcode?
Dr
Bro when you're doing nums[i]<nums[i+1] in if condition, And i=n-1, isn't it accessing nums[n] for i+1th index
Anshul
oh thanks
Anshul
Anonymous
Koi. Hacking class krta h??
Anonymous
Any one here do hacking class
Anonymous
I need contents of Hacking
DEV 7
#include <iostream> using namespace std; void print(int n){ if(n < 0){ return; } if(n == 0){ cout << n ; return; } print(n --); cout << n ; } int main() { int num = 3; print(num); } why this program give runtime error
Khushi
Hey.. I am thinking to start learning c language. If anyone could help... please dm me
Talula
#include <iostream> using namespace std; void print(int n){ if(n < 0){ return; } if(n == 0){ cout << n ; return; } print(n --); cout << n ; } int main() { int num = 3; print(num); } why this program give runtime error
#include <iostream> using namespace std; void print(int n){ if(n < 0){ return; } if(n == 0){ cout<<n<<endl; return; } cout<<n; print(--n); } int main() { int num = 3; print(num); } Maybe you wanted to do this.
Talula
I don't think he wants to return anything, he wants it to count backward using recursion.
Talula
#include <iostream> using namespace std; void print(int n){ if(n < 0){ return; } if(n == 0){ cout << n ; return; } print(n --); cout << n ; } int main() { int num = 3; print(num); } why this program give runtime error
Difference between n— and —n is if you say print(n—) then it'll send the value of n to the print function and when the function returns it'll decrement the value of n. if you do print(—n) it'll decrement first then it'll send the value.
DEV 7
#include<iostream> using namespace std; int sumarray(int* arr, int size ){ static int i=0; int sum; if(i>size){ return 0; } sum=arr[i]+sumarray(arr,size-1); i++; return sum; } int main(){ int arr[4]={1,2,3,4}; cout<<sumarray(arr,4); return 0; } i want to get sum of arrays using recursion , whats wrong with above code ?
Ehsan
that’s it
DEV 7
that’s it
😅😅😅😅 hmm
Ehsan
you don’t even need sum
Ehsan
int sumarray(int* arr, int size ){ if(size == 0) return 0; return arr[size-1] + sumarray(arr, size-1); }
Ale
Hi, could someone help me with this program?
Ale
Create a program that calculates the cash balance relating to a series of amounts entered cyclically by a user: the entry ends when 0 is typed which acts as a stopper of the sequence.
𝕄𝕠𝕙𝕒𝕞𝕞𝕒𝕕
.
suleiman
What is nested if?
Dr
If within if
Anonymous
AI
Oh no
Dr
AI
😂😂
Anonymous
Whats a good book
Anonymous
For. C++
Anonymous
Which can cover everything
klimi
cover everything?... i don't think that book exists... just pick one you like or look on stackoverflow if you need word from others
Abhishek
Can any one tell me best place to learn c++ from beginning
Abhishek
😂😂😂 I know that
Dr
Can any one tell me best place to learn c++ from beginning
To be honest having a good theory knowledge alone isn’t enough! In my opinion I’d suggest you to learn c++ from w3schools and try solving problems on platforms like hackerrank/leetcode / codeforces
Dr
Practising in the above mentioned platforms can boost your confidence
Khaerul
No