|
TPCCLIB
|
Read ASCII text file raw contents for further processing. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "tpcextensions.h"Go to the source code of this file.
Functions | |
| size_t | asciiFileSize (FILE *fp, int *nonprintable) |
| char * | asciiFileRead (FILE *fp, char *data, size_t maxlen) |
| int | asciiCommentLine (const char *line, int *cont) |
Read ASCII text file raw contents for further processing.
Definition in file readasciifile.c.
| int asciiCommentLine | ( | const char * | line, |
| int * | cont ) |
Check if ASCII text line starts with comment character '#'.
Comment character is searched from the first non-space character (space characters here include spaces and tabs).
| line | Pointer to string containing one line of ASCII text file. |
| cont | Optional pointer which is set to the index of line where the first non-space character after the comment character starts. If line does not start with comment character, then this will point to the first non-space character of the line. Enter NULL if not needed. |
Definition at line 149 of file readasciifile.c.
Referenced by iftPutFromString(), iftPutFromStringWithSpaceSeparator(), and tacFormatDetermine().
| char * asciiFileRead | ( | FILE * | fp, |
| char * | data, | ||
| size_t | maxlen ) |
Read at most maxlen-1 characters from given file pointer to ASCII text file.
| fp | File pointer; rewind() is NOT called here to allow reading data in chunks. |
| data | Pointer to character array in which the data is written; NULL, if memory is to allocated here (in that case remember to free it after use). Terminal zero is added. |
| maxlen | Nr of characters to read, and the size of data array (including terminal zero). |
Definition at line 117 of file readasciifile.c.
Referenced by csvRead(), iftRead(), and tacFormatDetermine().
| size_t asciiFileSize | ( | FILE * | fp, |
| int * | nonprintable ) |
Get the size of ASCII text file, or size of initial ASCII part of file containing binary data after the text part (in certain image formats).
One NUL character is not counted as binary data, but two already is; this, because equipment failures sometimes lead to data ending with NUL.
| fp | File pointer; rewind() is called before returning. |
| nonprintable | Value will be set to 1 if reading was stopped at a non-printable character meaning that file may contain a binary part, or to 0 if file contains only printable characters and size of all contents was counted. Enter NULL, if not needed. |
Definition at line 26 of file readasciifile.c.
Referenced by csvRead(), iftRead(), tacFormatDetermine(), and tacRead().