I tried to create simple app which will connect to deezer and play single song. I got access token and wrote this program. Target machine: linux x86_64 API version: v1.0.1 Suddenly i ran into problems. First run shows me this output: 398748:201417 dz_bufferevent: [dz_bufferevent_on_activation:561] could not open /var/tmp/settings.dat I created this file, but I suspect that it shouldn’t be empty.
Tag: c++
resend packets via RAW sockets in linux
It’s needed to read raw data from one interface and send it via another. open&&config(the same for sock_raw_outer): then in cycle: then, if I catch on sock_raw_inner any packet(arp request, for example), it sended on sock_raw_inner again and again by sendto. What’s wrong? Thanks. Answer Your sock_raw_inner is still listening on every interface because the bind on eth0 you are
Undefined reference to process(std::__cxx11::basic_string … ) when compiling affdex linux sample applications
I encountered the following error when I tried to compile affdex sdk sample applications I’m using GCC 5.2.1 Answer My initial suspicion was that the problem is attempting to compile the apps using a newer GCC or rather GLIBCXX than what the sdk is compiled with (gcc v4.8). The error msg refers to an undefined function that the compiler is
How to compile C code on Linux/GCC without deprecated functions being available?
There are old functions such as index, rindex which have now been superseded by strchr and strrchr. Is there a way to configure the compiler or defines so these functions aren’t available? It can cause confusing warnings when: accidentally using index name outside of scope for eg – or worse, not warn and use the function in a way that’s
scp .tar file from remote machine using C program & libssh
I have written a code which read file from remote device using libssh scp APIs. I have a specific requirement wherein I want to scp a .tar file from a remote device. I am able to read .tar content into a buffer, but I am not sure how to create .tar file out of that buffer. Any help would be
POSIX timer hangs up after a few runs
I have created a POSIX timer in the main function of my program. Each thread of the main program is setting the timer so that on expiry of it, the signal handler update one variable which awakes the next thread of the same process. The timer is working fine most of the time but not always. It sometimes completes the
Embedded Python3 raise an exception when importing a local module
I’m trying to embed a Pyhton3 program into a C++ one. After following several tutorials and blog posts I get the following code, which fails: The result is the following: So, importing sys works but importing my own module fails, while adding the path to my modules seemed to work. Any idea ? Answer Replacing PyBytes_FromString by PyUnicode_DecodeFSDefault made the
How can I compile GCC with a shared library?
I create shared library libpl.so. I use this command to create connections: And now I try to compile my program using: but I have errors: What should I do to fix it? How can I compile it? Answer The line works correctly. Compile with: Run with:
Optimal way of writing to append-only files on an SSD
I want to know what’s the optimal way to log to an SSD. Think of something like a database log, where you’re writing append-only, but you also have to fsync() every transaction or few transactions to ensure application level data durability. I’m going to give some background on how SSDs work, so if you already know all this, please skim
implicit declaration of function ‘sched_setaffinity’
I’m writing a program which needed to be run on single core. To bind it to single core, I’m using sched_setaffinity(), but the compiler gives warning: implicit declaration of function ‘sched_setaffinity’ My test code is: Can you please help me to figure it out. Actually code is compiled and run, but I’m not sure whether it is running on single