tesseract 3.04.01

ccutil/scanutils.h

Go to the documentation of this file.
00001 // Copyright 2006 Google Inc.
00002 // All Rights Reserved.
00003 // Author: renn
00004 //
00005 // Contains file io functions (mainly for file parsing), that might not be 
00006 // available, on embedded devices, or that have an incomplete implementation 
00007 // there.
00008 //
00009 // Licensed under the Apache License, Version 2.0 (the "License");
00010 // you may not use this file except in compliance with the License.
00011 // You may obtain a copy of the License at
00012 // http://www.apache.org/licenses/LICENSE-2.0
00013 // Unless required by applicable law or agreed to in writing, software
00014 // distributed under the License is distributed on an "AS IS" BASIS,
00015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 // See the License for the specific language governing permissions and
00017 // limitations under the License.
00018 
00019 #ifndef TESSERACT_CCUTIL_SCANUTILS_H_
00020 #define TESSERACT_CCUTIL_SCANUTILS_H_
00021 
00022 #include <stdint.h>
00023 #include <stddef.h>
00024 #include <stdio.h>
00025 #include <sys/stat.h>
00026 
00037 int tfscanf(FILE* stream, const char *format, ...);
00038 
00039 #ifdef EMBEDDED
00040 
00041 // Attempts to parse the given file stream s as an integer of the base
00042 // 'base'. Returns the first successfully parsed integer as a uintmax_t, or
00043 // 0, if none was found.
00044 uintmax_t streamtoumax(FILE* s, int base);
00045 
00046 // Parse a file stream according to the given format. See the fscanf manpage
00047 // for more information, as this function attempts to mimic its behavior.
00048 // Note that scientific loating-point notation is not supported.
00049 int fscanf(FILE* stream, const char *format, ...);
00050 
00051 // Parse a file stream according to the given format. See the fscanf manpage
00052 // for more information, as this function attempts to mimic its behavior.
00053 // Note that scientific loating-point notation is not supported.
00054 int vfscanf(FILE* stream, const char *format, va_list ap);
00055 
00056 // Create a file at the specified path. See the creat manpage for more 
00057 // information, as this function attempts to mimic its behavior.
00058 int creat(const char *pathname, mode_t mode);
00059 
00060 // Convert the specified C-String to a float. Returns the first parsed float,
00061 // or 0.0 if no floating point value could be found. Note that scientific
00062 // floating-point notation is not supported.
00063 double strtofloat(const char* s);
00064 
00065 #endif  // EMBEDDED
00066 
00067 #endif  // TESSERACT_CCUTIL_SCANUTILS_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines