Skip to content

getline() is repeatedly reading the file, when fork() is used

I am developing a simple shell program, a command line interpreter and I wanted to read input from the file line by line, so I used getline() function. At the first time, the program works correctly, however, when it reaches the end of the file, instead of terminating, it starts to read a file from the start …

Redirect output from terminal to libreoffice excel file

I am running a code on a particular core and am monitoring the cache misses in that particular core every second when my code is running. I can redirect that output to a .txt file. I wanted to know if it is possible to redirect the output to a libreoffice excel file which will allow me to generate a graph

Using $() in docker commands doesn’t seem to work

I want to stop all running docker containers with the command sudo docker stop $(docker ps -a -q). But when I run it, docker outputs Just running docker ps -a -q outputs the Docker IDs, but when I combine it with a Docker command, it doesn’t work. Thank you. Answer I didn’t realize that the sudo i…

Matlab’s fwrite: What happens to skipped bytes?

Suppose I have the following code: Then this would open an earlier specified file, skip the first 10 bytes and write 1 into the following two. But what happens to the first 10 bytes, assuming the opened file did not exist before? If I were to access one, what would I end up getting and why? Answer From the PO…

How can i get memory usage by a process in freeRTOS

As we all know, we can get RAM currently used by a process in Linux using commands like ps, top and vmstat or reading the pseudo-filesystem /proc. But how can i get the same information in freeRTOS where we could not use commands and there exist no file system. Answer First there’s no process context in…