📄 rmfile.tex
字号:
\subsubsection*{Purpose}Deletes a file.\subsubsection*{Prototype}\code{esint16 rmfile(FileSystem *fs,euint8* filename);}\subsubsection*{Arguments}Objects passed to \code{rmfile}:\begin{itemize} \item{\code{fs}: pointer to the FileSystem object} \item{\code{filename}: pointer to the path + name of the file to be removed}\end{itemize}\subsubsection*{Return value}Returns 0 if no errors are detected.\\\newlineReturns non-zero if an error is detected, most likely that the file does not exist.\subsubsection*{Note}If you have opened a file with \code{fopen()}, and you wish to delete it, firstclose all instances of that file. If you do not, you may corrupt the filesystem.\subsubsection*{Example}\lstset{numbers=left, stepnumber=1, numberstyle=\small, numbersep=5pt, tabsize=4}\begin{lstlisting} #include "efs.h" void main(void) { EmbeddedFileSystem efsl; /* Initialize efsl */ DBG((TXT("Will init efsl now.\n"))); if(efs_init(&efsl,"/dev/sda")!=0){ DBG((TXT("Could not initialize filesystem (err \%d).\n"),ret)); exit(-1); } DBG((TXT("Filesystem correctly initialized.\n"))); /* Delete some files */ rmfile(&efsl.myFs,"file0.txt"); rmfile(&efsl.myFs,"dir0/file0.txt"); /* Close filesystem */ fs_umount(&efsl.myFs); }\end{lstlisting}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -