⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file_write.tex

📁 嵌入式文件系统 EFSL 0.3.5 / 嵌入式文件系统 EFSL 0.3.5
💻 TEX
字号:
\subsubsection*{Purpose}Reads a file and puts it's content in a buffer.\subsubsection*{Prototype}\code{euint32 file\_write(File *file, euint32 size, euint8 *buf)}\subsubsection*{Arguments}Objects passed to \code{file\_read}:\begin{itemize}	\item{\code{file}: pointer to a File object}	\item{\code{size}: amount of bytes you want to write}	\item{\code{buf}: pointer to the buffer you want to write the data from}\end{itemize}\subsubsection*{Return value}Returns the amount of bytes written.\subsubsection*{Example}\lstset{numbers=left, stepnumber=1, numberstyle=\small, numbersep=5pt, tabsize=4}\begin{lstlisting}	#include <string.h>	#include "efs.h"	void main(void)	{		EmbeddedFileSystem efsl;		euint8 *buffer = "This is a test.\n";		euint16 e=0;		File file;		/* 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")));		/* Open file for writing */		if(file_fopen(&file, &efsl.myFs, "write.txt", 'w')!=0){			DBG((TXT("Could not open file for writing.\n")));			exit(-1);		}		DBG((TXT("File opened for reading.\n")));		/* Write buffer to file */		if( file_write(&file,strlen(buffer),buffer) == strlen(buffer) )			DBG((TXT("File written.\n")));		else			DBG((TXT("Could not write file.\n")));				/* Close file & filesystem */		fclose(&file);		fs_umount(&efs.myFs);	}\end{lstlisting}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -