Skip to content
Advertisement

Tag: file-io

How can I time out an input/output redirection in Linux?

I was wondering whether or not it is possible to time out an input/output redirection in Linux. Meaning that I would like to redirect certain input/output to a file just for a time span of 2s for instance. In a practical case, I am looking to cat the tty0 to a file only during 2s How can I achieve this?

How one can safely serialize std::basic_istream::pos_type?

In one of my projects I have to cache positional information about certain data chunks found in large files. I’ve already implemented a small API built around std::basic_istream<char>::pos_type placed in maps. Now I need to serialize these descriptors into a bytestream and write them on a disk for further usage (on other *nix-machines as well). I have read that this

Making a virtual file in Linux

I’m working with some existing software that I cannot change, and it loads its config data from a bunch of config files, all following the same naming scheme – let’s say, file_param1.conf, file_param2.conf, file_param3.conf etc. The difference between the content of the files is just param1 vs param2 vs param3, so a typical config file will look like or Is

Errors opening a file in c

currently I’m having problems with the function below trying to open a file, no matter what I give it the function can’t seem to open the file. I’m currently passing in “./input.txt” which is a file in the same directory as the executable. Is there anything blatantly wrong with the code that you guys can see? Answer You are returning

Python cron job file access

I have a tiny Python script that needs to read/write to a file. It works when I run it from the command line (since I am root, it will) , but when the cron job runs it cannot access the file. The file is in the same folder as the script and is (should) be created from the script. I’m

pass stdout as file name for command line util?

I’m working with a command line utility that requires passing the name of a file to write output to, e.g. The only thing it writes to stdout is a message that indicates that it ran successfully. I’d like to be able to pipe everything that is written to output.txt to another command line utility. My motivation is that output.txt will

Advertisement