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

📄 stdio.h

📁 TINI的pop3的c代码
💻 H
📖 第 1 页 / 共 3 页
字号:
 * Generates a path/filename that can be used to create a temporary file with.
 * The pointer that is returned is suitable to be freed using #mem_free.  Make sure
 * to use the Dallas Semiconductor memory management library (rom400_mem.h)
 * rather than the Keil memory manager to free the memory.
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     dirname  Directory for temporary file name to be created for.
 *                     A default directory will be used if <i>dirname</i> 
 *                     is null.
 * \param     pfx      Prefix to prepend to temporary file name
 *
 * \return    Pointer to temporary file name.  Use #Free to delete the memory.
 *
 * \sa        #tmpnam
 * \sa        #tmpfile
 * \sa        #Free      [in the memory manager library]
 */
//---------------------------------------------------------------------------
char*    tempnam(const char* dirname, const char* pfx);                          

/**
 * \brief     Generates a stream to a temporary file.
 *
 * Generates a stream to a temporary file, opened for writing/update.  
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \return    File handle to a temporary file, or #NULL on failure.
 *
 * \sa        #tempnam
 * \sa        #tmpnam
 */
//---------------------------------------------------------------------------
FILE*    tmpfile(void);                                                          

/**
 * \brief     Generates a uniqe temporary filename.
 *
 * Capable of generating #TMP_MAX unique temporary filenames.  This filename
 * is suitable for using in a call to <i>#fopen</i>.  If the name is written 
 * to a static location, then this call destroys the previous filename 
 * stored in that location.
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     nametarget  Storage location for new temporary name.  If NULL,
 *                        the temporary name will be copied to a static 
 *                        location.
 *
 * \return    Location where temporary name is stored.  This may be the same
 *            as <i>nametarget</i>.
 *
 * \sa        #tempnam
 * \sa        #tmpfile
 */
//---------------------------------------------------------------------------
char*    tmpnam(char* nametarget);                                               

/**
 * \brief     Flushes the buffers for a file stream.
 *
 * The TINI File System has no buffers (data is read and written directly 
 * on the file system, since it resides in XDATA).  Therefore, this function
 * only clears the error flag.
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     f_handle  File handle to flush output buffers for
 *
 * \return    0 on success.
 *
 */
//---------------------------------------------------------------------------
int      fflush(FILE* f_handle);



// Non-standard functions that are useful/necessary.



/**
 * \brief     Initializes the file system to a blank state.
 *
 * Initializes the file system.  This method (or <i>#finit</i>) must be 
 * called every time the DS80C400 boots up and wants to use the file system.  
 * Starts with a blank file system automatically.
 *
 * Note that the <i>#init_rom</i> function must be called before the
 * file system is initialized.
 * 
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     numfd          Maximum number of file descriptors that can
 *                           be open at one time in the system.
 * \param     numblocks      Number of 256-byte blocks available to the
 *                           file system.
 * \param     start_address  Starting address of the memory allocated
 *                           for the file system.  The bounds of the 
 *                           memory allocated for the file system are
 *                           then from <i>start_address</i> to 
 *                           (<i>start_address</i> + 256 * <i>numblocks</i>).
 * 
 * \return    Non-zero, since the file system memory had to be erased.
 *
 * \sa        #init_rom    [in the initialization library]
 * \sa        #finit
 */
//---------------------------------------------------------------------------
int      fcleaninit(char numfd, int numblocks, void* start_address);

/**
 * \brief     Initializes the file system.
 *
 * Initializes the file system.  This method (or <i>#fcleaninit</i>) must be 
 * called every time the DS80C400 boots up and wants to use the file system.  
 * If the file system does not exist or is corrupted, it will erase and 
 * start with a blank file system.  Also, if any of the parameters given to 
 * <i>#finit</i> do not match how the file system was previously
 * initialized, the file system will erase and start blank.
 *
 * Note that the <i>#init_rom</i> function must be called before the
 * file system is initialized.
 * 
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     numfd          Maximum number of file descriptors that can
 *                           be open at one time in the system.
 * \param     numblocks      Number of 256-byte blocks available to the
 *                           file system.
 * \param     start_address  Starting address of the memory allocated
 *                           for the file system.  The bounds of the 
 *                           memory allocated for the file system are
 *                           then from <i>start_address</i> to 
 *                           (<i>start_address</i> + 256 * <i>numblocks</i>).
 * 
 * \return    0 if the file system previously existed and was restored.
 *            Non-zero if the file system memory had to be erased.
 *
 * \sa        #init_rom    [in the initialization library]
 * \sa        #fcleaninit
 */
//---------------------------------------------------------------------------
int      finit(char numfd, int numblocks, void* start_address);

/**
 * \brief     Tests for the existence of a file.
 *
 * Checks to see if the file <i>filename</i> exists in this
 * file system.
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \param     filename  File to check for the existence of.
 *
 * \return    0 if the file exists, non-zero if it does not exist.
 */
//---------------------------------------------------------------------------
int      fexists(char* filename);

/**
 * \brief     Helper function that opens a file descriptor.
 *
 * Helper function that opens a file descriptor.  File descriptors are not
 * immediately useful to any C library function.  Applications should
 * use the <i>#fopen</i> function to open a file. 
 *
 * \warning   This function is not multi-process safe.  If two processes
 *            try to call this function at the same time, its parameters
 *            may be destroyed, yielding unpredictable results.
 * 
 * \param     filename  Name of the file to get a descriptor for.  The data
 *                      pointed to by <i>filename</i> must stay consistent
 *                      for the duration of the use of the file descriptor.
 *                      The <i>#fopen</i> method avoids this limitation by
 *                      creating a copy of the name data.
 * \param     mode      Read/Write/Append mode string
 *
 * \return    pointer to a file descriptor
 *
 * \sa        #fopen
 */
//---------------------------------------------------------------------------
void*    fopen_fd(const char* filename, const char* mode);

/**
 * \brief     Reads bytes into a buffer from a file stream.
 *
 * Reads a specified number of bytes into a buffer from a file stream.
 * This function is used by <i>#fread</i> as a helper function.  It may 
 * safely be used from user applications, although it is not a standard
 * file reading function (is not part of an ANSI-C standard library).
 * 
 * \warning   This function is not multi-process safe.  If two processes
 *            try to call this function at the same time, its parameters
 *            may be destroyed, yielding unpredictable results.
 * 
 * \param     buffer  Location to read data into
 * \param     length  Number of bytes to read
 * \param     stream  File to read data from
 * 
 * \return    Number of bytes read, or #EOF if the end of file is
 *            reached.
 * 
 * \sa        #fread
 * \sa        #fwritebytes
 */
//---------------------------------------------------------------------------
unsigned int freadbytes(void* buffer, int length, FILE* stream);

/**
 * \brief     Writes bytes to a file stream.
 *
 * Writes the specified number of bytes to a file stream.
 * This function is used by <i>#fwrite</i> as a helper function.  It may 
 * safely be used from user applications, although it is not a standard
 * file writing function (is not part of an ANSI-C standard library).
 * 
 * \warning   This function is not multi-process safe.  If two processes
 *            try to call this function at the same time, its parameters
 *            may be destroyed, yielding unpredictable results.
 * 
 * \param     buffer  Location to write data from
 * \param     length  Number of bytes to write
 * \param     stream  File to write data to
 * 
 * \return    Number of bytes written, or #EOF if an error occurred
 * 
 * \sa        #fwrite
 * \sa        #freadbytes
 */
//---------------------------------------------------------------------------
unsigned int fwritebytes(void* buffer, int length, FILE* stream);

/**
 * \brief     Gets the amount of free space in the file system.
 *
 * Returns the number of bytes available to the file system.  Note that
 * this number is completely independent of the amount of free RAM available
 * from the ROM's memory manager.  The TINI File System uses its own 
 * independent memory manager.
 *
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \return    Amount of free RAM available to the file system.
 */
//---------------------------------------------------------------------------
unsigned long getfreefsram();

/**
 * \brief     Creates a directory.
 *
 * Creates a directory with the specified directory name.  
 * 
 * This function is safe to be called from multiple processes at the same 
 * time.
 *
 * \return    non-zero on success, 0 on failure
 */
//---------------------------------------------------------------------------
int      mkdir(char* dirname);




/*
 * The following functions are provided by the Keil libraries.  We re-export them
 * since we are basically overriding stdio.h here.  Please see the Keil 
 * documentation for information on these functions.
 */

/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern char _getkey (void);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern char getchar (void);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern char ungetchar (char);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern char putchar (char);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int printf   (const char *, ...);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int sprintf  (char *, const char *, ...);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int vprintf  (const char *, char *);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int vsprintf (char *, const char *, char *);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern char *gets (char *, int n);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int scanf (const char *, ...);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int sscanf (char *, const char *, ...);
/** \brief Keil-provided function
 *
 * This is a Keil-provided function.  Please see Keil's documentation for
 * information on this function.  It is exported by this header file so
 * that we can override <i>stdio.h</i>.
 */
extern int puts (const char *);


/**
 * \brief        Returns the version number of this file system library.
 *
 * \return       Version number of this FILESYSTEM library.
 */
//---------------------------------------------------------------------------
unsigned int filesystem_version(void);



#pragma RESTORE


#endif

⌨️ 快捷键说明

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