libsent/src/util/readfile.c File Reference

Read strings per line from various input source. More...

#include <sent/stddefs.h>
#include <sent/tcpip.h>
#include <zlib.h>

Go to the source code of this file.

Functions

char * getl (char *buf, int maxlen, FILE *fp)
 Read one line from file that has been opened by fopen_readfile().
char * getl_fp (char *buf, int maxlen, FILE *fp)
 Read one line from file pointer.
char * getl_fd (char *buf, int maxlen, int fd)
 Read one line from a file descriptor.
char * getl_sd (char *buf, int maxlen, int sd)
 Read one line from a socket descriptor.
char * get_line_from_stdin (char *buf, int buflen, char *prompt)
 Get one file name from stdin with a prompt .


Detailed Description

Read strings per line from various input source.

This file provides functions to read text inputs from various input source such as file pointer, file descpritor, socket descriptor. The input will be read per line, and the newline characters are removed. Also, blank lines will be ignored.

Author:
Akinobu LEE
Date:
Thu Feb 17 16:41:58 2005
Revision
1.1.1.1

Definition in file readfile.c.


Function Documentation

char* getl ( char *  buf,
int  maxlen,
FILE *  fp 
)

Read one line from file that has been opened by fopen_readfile().

Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer or gzFile pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 53 of file readfile.c.

Referenced by add_bigram(), add_unigram(), get_total_info(), ngram_read_arpa(), rddfa(), rdhmmlist(), read_token(), set_ngram(), set_unigram(), voca_load_htkdict(), and voca_load_wordlist().

char* getl_fp ( char *  buf,
int  maxlen,
FILE *  fp 
)

Read one line from file pointer.

Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 86 of file readfile.c.

Referenced by adin_file_begin(), htk_config_file_parse(), main_recognition_stream_loop(), and multigram_add_prefix_filelist().

char* getl_fd ( char *  buf,
int  maxlen,
int  fd 
)

Read one line from a file descriptor.

Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fd [in] file descriptor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 114 of file readfile.c.

Referenced by rddfa_fd(), and voca_load_htkdict_fd().

char* getl_sd ( char *  buf,
int  maxlen,
int  sd 
)

Read one line from a socket descriptor.

Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
sd [in] socket descpritor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 152 of file readfile.c.

Referenced by rddfa_sd(), and voca_load_htkdict_sd().

char* get_line_from_stdin ( char *  buf,
int  buflen,
char *  prompt 
)

Get one file name from stdin with a prompt .

Blank line is omitted.

Parameters:
buf [out] buffer to hold input text line
buflen [in] length of the buffer
prompt [in] prompt string
Returns:
pointer to buf, or NULL on EOF input.

Definition at line 193 of file readfile.c.

Referenced by adin_file_begin(), main(), and main_recognition_stream_loop().


Generated on Tue Dec 18 16:01:41 2007 for Julius by  doxygen 1.5.4