I’ve coded a simple sequencer in C with SDL 1.2 and SDL_mixer(to play .wav file). It works well and I want to add some audio synthesis to this program. I’ve look up the and I found this sinewave code using SDL2(https://github.com/lundstroem/synth-samples-sdl2/blob/master/src/synth_samples_sdl2_2.c) Here’s how the sinewave is coded in the program: I don’t understand how I could change the sinewave formula
Tag: c++
POSIX open() hangs on SMB share
I have a problem where I mount a Windows SMB share under linux with mount.cifs and write to files from my C++ program. This works fine, but as soon as network problems arise (i.e. Windows server disconnect), opening the file with POSIX open() will hang indefinitely. The same happens for the POSIX close() call if the share disconnects while the
How do I expose custom files similar to /procfs on Linux?
I have a writer process which outputs its status at regular intervals as a readable chunck of wchar_t. I would need to ensure the following properties: When there’s and update, the readers shouldn’t read partial/corrupted data The file should be volatile in memory so that when the writer quits, the file is gone The file content size is variable Multiple
Linker –whole-archive option
I am using C language. I am linking static libraries with –whole-archive. Linker is arm-none-eabi-ld For example, giving the following option to the linker: But still I get linking error: Why is the linking error happening? EDIT: Full command with output: Out put of: readelf -Ws kunit.a hal.a fs.a | egrep ‘ (mmu_init|exec_array|mmu_pagetable|_enter_kernel)’ is: Answer Why is the linking error
Find a directory in shared library search path : Another solution?
Nine years ago, this question has been asked : Find a directory in shared library search path (Find a directory in shared library search path). An answer has been given using : opendir() then readdir() then dlopen() … Nowadays, is there a simpler way to do it or should I still follow this SMOP ? Answer No, using scandir() or
C/C++: POSIX compatible way to find default network interface up/down
I’m working on POSIX platform (PSE51 to be exact). I want to get notified when the default network interface goes up/down (via a callback or through continuous poll). The challenge is that I could find a linux specific way to get the default interface here and found a linux specific way to find the network is up or down here
How to declare a global variable in an header file and how he need to be in the c file
i have a serious problem to understand how to declare a global variable in an header file and how he need to be in the c file. In my .h : extern struct my_global_variable glob; and on my .c i add to reference it : struct my_global_variable glob; Is it like that ?? Thanks you for your answer and have
*** No targets. Stop on Linux using C [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question This is a very basic program because I am using Make and Linux
insmod fails with “Unknown symbol in module”
I am working on Linuxmint Cinnamon 19 Ubuntu 18.04, kernel version 4.15.0-20-generic The following I see during compilation: Then I try to install the module with sudo insmod elevator.ko Seeing in the logs: dmesg | tail Makefile elevator.c issue_request.c start_elevator.c stop_elevator.c Functions are static and there is only one makefile in same directory. So my question is: Why can’t the
Meaning of dup2() POSIX function with second argument equals Zero
Sometimes I see strange usage of dup2() function. For example: It doesn’t even check the return value. What exactly does it do with such arguments? The man dup2 says that if newfd (second argument of dup2) was previously open, it is silently closed before being reused. But the 0 is stdin and why do we even need to do that?