ICU-3499 Add u_feof()

X-SVN-Rev: 14992
This commit is contained in:
George Rhoten 2004-04-16 05:47:01 +00:00
parent 7f47730a47
commit 95c021fb7c
2 changed files with 31 additions and 5 deletions

View file

@ -114,12 +114,26 @@ u_fopen(const char *filename,
return result;
}
U_CAPI UBool U_EXPORT2
u_feof(UFILE *f)
{
UBool endOfBuffer;
if (f == NULL) {
return TRUE;
}
endOfBuffer = (UBool)(f->str.fPos >= f->str.fLimit);
if (f->fFile != NULL) {
return endOfBuffer && feof(f->fFile);
}
return endOfBuffer;
}
U_CAPI void U_EXPORT2
u_fflush(UFILE *file)
{
ufile_flush_translit(file);
fflush(file->fFile);
/* TODO: flush input */
ufile_flush_translit(file);
fflush(file->fFile);
/* TODO: flush input */
}
U_CAPI void

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1998-2003, International Business Machines
* Copyright (C) 1998-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -41,7 +41,8 @@
* Make sure that #, blank and precision in the printf format specification
works.
* Make sure that * in the scanf format specification works.
* Each UFILE takes up at least 2KB. This should be really reduced.
* Each UFILE takes up at least 2KB.
Look into adding setvbuf() for configurable buffers.
* This library does buffering. The OS should do this for us already. Check on
this, and remove it from this library, if this is the case. Double buffering
wastes a lot of time and space.
@ -167,6 +168,17 @@ u_finit(FILE *f,
U_CAPI void U_EXPORT2
u_fclose(UFILE *file);
/**
* Tests if the UFILE is at the end of the file stream.
* @param f The UFILE from which to read.
* @return Returns TRUE after the first read operation that attempts to
* read past the end of the file. It returns FALSE if the current position is
* not end of file.
* @draft
*/
U_CAPI UBool U_EXPORT2
u_feof(UFILE *f);
/**
* Flush output of a UFILE. Implies a flush of
* converter/transliterator state. (That is, a logical break is