Skip to content
Advertisement

Tag: c++

Editing single value in file in C efficiently

I have a C program that currently edits a single value in a parameter file by using sed through a system call. I’d like to change the program to use the C file libraries to edit this value, but the only way I know how to do this is by reading in the entire file, changing the value, and rewriting

What type of memory objects does `shm_open` use?

Usually, shared memory is implemented using portions of On-Disk files mapped to processes address spaces. Whenever a memory access occurs on the shared region, the filesystem is involved to write changes on the disk which is a great overhead. Typically, a call to fopen() returns a file descriptor which is passed to mmap() to create the file’s memory map. shm_open,

Makefile – wildcard and recipe build

I have the following makefile I got this message : make: Circular src/paquet/packet_implem.o <- src/paquet/packet_implem.o dependency dropped. gcc -std=c99 -Wall -Werror -Wshadow -Wextra -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -lz -rdynamic -I/home/jy95/local/include -L/home/jy95/local/lib; /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function _start’: (.text+0x20): undefined reference tomain’ collect2: error: ld returned 1 exit status Makefile:71: recipe for target ‘src/paquet/packet_implem.o’ failed make: *** [src/paquet/packet_implem.o] Error 1 What I want

Can boost lib built on windows with msvc be used in a linux program

I built boost from source on windows. I can compile with it on windows. When I want to compile with it in linux : Unable to find the requested Boost libraries. Boost version: 1.65.1 Boost include path: pathtoproject/deps/boost Could not find the following Boost libraries: No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing

Unable to connect to any specified mysql C#

I can’t connect to my sql server, i tried some fixes from stackoverflow and google and it didn’t help me. Thanks. To configure myuser I used this on my linux vps. i tried : Unable to connect to any of the specified mysql hosts. C# MySQL ( i tried to use MySqlConnectionStringBuilder, don’t specify the port, instead of password in

Get all mount points in kernel module

I’m trying to get all the mount points in a kernel module. Below is what I’ve come up with. It segfaults because of the strcat. Is this the correct way to get the mount points? Will this work? if so how do i fix the segfault? If not, how does one go about getting the mount points in a linux

g++ undefined reference error when linking to third party shared libraries

I’m trying to link a c++ program that uses several shared libraries from 3rd parties. Mainly, these libraries come from a github project called MBSim and I downloaded the latest daily build with all its binaries, libraries and headers, which I installed on /usr/local/mbsim-env. The most important libraries called are libmbsim, libopenmbvcppinterface, libfmatvec and libboost_filesystem (the last one comes with

How to ensure a posix c socket is still valid

I,m working on an embedded linux kernel 2.6 device and need to know if previously established socket is still valid or not,Also I can not do this with usual send function and check the returned value,because if I send to the invalid socket descriptor,my application will crash and linux will shut down my process.Is there any other function/suggestion for this

Advertisement