Skip to content
Advertisement

Tag: c++

C Linux Check free space in mount

When I running df -h I can see that in /dev I use 6M and the size is 40M , and Available size is 34M . How can I get this information with c code? Answer From here: Use the statvfs API: and the prototype of the statvfs is The results will be filled to the buf statvfs struct: The

How do run executable c++ through terminal in debug mode?

I have a c++ executable file named test .. To execute it in my terminal I run….. Although I want to run it in debug mode wherein it shows the exact command being used immediately after being executed If you are wondering what exactly I mean by debug mode.. Just like how we use -x for shell scripts This shows

Memory layout of C program

When I run this C code, I get the following output as shown. What these numbers mean, why they are like that and what can we learn from it about the position of the variables. Output: Answer In general, memory is laid out as such: When you initialize a local variable like a, b, age, each variable is allowed to

Multithreaded word count in C

I know I said I would try to figure it out on my own and I really did, and then I looked elsewhere first before posting here again but then I just ended up with this mess: How best should I fix this? Specifically these errors and warnings: I think the part for counting words from the buffer is okay,

gcc-7: error: unrecognized command line option ‘-m64’

I’m trying to compile C code on a Jetson Nano and I get this error during compiling. I tried removing any occurrence of ‘m -64’ but it seems like its added automatically. This is the cmd where it fails: /usr/bin/gcc-7 -Wall -Wextra -Wconversion -pedantic -Wshadow -m64 -Wfatal-errors -O0 -g -o CMakeFiles/dir/testCCompiler.c.o -c /home/user/dir/CMakeFiles/CMakeTmp/testCCompiler.c gcc-7: error: unrecognized command line option ‘-m64’

Debugging Linux process hangs, which code is it running?

I have a process running on a very weak Linux embedded device, which could not run gdb / gdb server on itself. I let it provoking a function X from a shared library repeatedly (there are also some others process calling it at the same time with much less frequency), it usually hangs somewhere inside the shared library after 1

Advertisement