What is the difference in removing a file using the c function remove(fileName) or a system call with the "rm -rf fileName") command? If the remove(fileName) fails to remove a file (when the file is corrupted) - is the system("rm -rf fileName") kind of "stronger" and will remove the corrupted file, that remove() function failed to remove?
C++ for QNX: delete corrupted file using remove(fileName) vs system("rm -rf fileName")?
60 Views Asked by Supersuslik At
1
There are 1 best solutions below
Related Questions in FILE
- Helpt with reading files
- Why can't I use the file pointer after the first read attempt fails?
- Can't read the file using std::wifstream C++
- How can the scanner reread the entire file after it has already executed hasNextLine once?
- What is 'Invalid Load Key, '\x00'
- php $_FILE variable undefined index
- Data loaded from the file is not returned in the correct order
- File splitting and encryption
- Optimizing an s5cmd command that uses awk to generate a text file
- segmentation fault while reading in text file ( c++ )
- File.OpenText is adding C:\ to the front which is an error
- UTF-8 issue with excel
- How to upload files to MediaWiki APIs in Rust?
- No such file or directory: '/tmp/tmp_ejr26m6.upload.mp3' in Django
- Problems accessing zip files on the react front end from express backend
Related Questions in QNX
- Linux to QNX USB driver convert
- Unable to load library from custom paths during compilation
- verify if binary is compiled using gnx gcc or qnx qcc
- How to mount a shared region under /dev/shmem in QNX?
- How can I best debug a Python crash due to SIGSEVG in QNX?
- Build GDB Source Code for QNX (QNX App Debugging alternative)
- Regex with posix regex.h faild to match
- Unable to write to specific region of RAM using mmap
- Realtime OS: PREEMPT_RT Linux vs QNX and other
- How to install Gstreamer on QNX 7.?
- State pattern implementation in C++ run into segmentation fault
- C++ for QNX: delete corrupted file using remove(fileName) vs system("rm -rf fileName")?
- Is QNX channel is true bidirectional?
- What is the best QNX alternatve to Linux strace
- Can an excessive use of smart pointers lead to an increase in system kernel calls?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
What is the difference?
The difference is that remove needs to meet some conditions to remove a file. The QNX docu states: The remove() function removes a link to a file:
Especially point 3 is interesting in your case.
Here is the Docu for remove() in QNX Docu remoce()
rm "fileName", specifically rm -f "fileName" attempts to remove the files without prompting for confirmation, regardless of the file’s permissions.
By the way the -r flag is for directories. If you just want to delete files you don't need that.
Here is the docu for rm in QNX Docu rm
Is rm -f "stronger" than remove
Depending on how the file was corrupted rm -f can be "stronger" then remove, but both are not 100 % sure to remove a corrupted file. To handle corrupted file you have to look at the error messages thrown and maybe use an memory analysis tool.