Highly Reusable Software
Professions, Sciences, Humanities, Business, ...
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...
Conversions, tests, processing, manipulation,...
Integer, Floating point, Matrix, Statistics, Boolean, ...
Algorithms, Memory, Process control, Debugging, ...
Data storage, Integrity, Encryption, Compression, ...
Networks, protocols, Interprocess, Remote, Client Server, ...
Timing, Calendar and Clock, Audio, Video, Printer, Controls...
Management, Filtering, File & Directory access, Viewers, ...
librock_counttoeol - count consecutive characters up to (but not including) next \0 \n or \r
#License - #Source code - #Example Use -
const char *psz
Returns count of consecutive characters up to (but not including) next \0 \n or \r
Typical use is to advance a pointer, replacing code like:
while((*ptr != '\r')&&(*ptr != '\n')&&(*ptr != '\0')) ptr++;
ptr += librock_counttoeol(ptr);
Also used in parsing, where the count is needed to copy,
compare, or write a limited number of characters starting
at ptr. For example:
Also used to chop off the newline part of a string buffer.
buffer[librock_counttoeol(buffer)] = '\0';
librock_assert() // #ifdef librock_DEBUG
Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com
Open-source under MIT license. NO WARRANTY. Copies must retain this block.
License text in <librock/license/mit.txt> librock_LIDESC_HC=cc598307414a9997b32b60a2e7a8e7c6a13d6438
./text/count.c (implementation, plus source of this manual page)
This software is part of Librock
Rapid reuse, without rework.
- Source code which is Open-source, Free (Libre) and free (no cost)
- Namespace limited. All compile-time macros and names visible at link time are prefixed by "librock_". Integrate into your project and expect no name collisions.
- Stable API means new functions get new names so that there is no risk that updating a source file will break existing applications.
- Highly portable, cross-platform, and multithread compatible. Works with many machines, compilers, and operating systems (gcc/MSVC/Windows/Linux/BSD).
This page copyright (C) 2002-2004 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA
Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)
Want to help? We welcome comments, patches. -- Need help? Request paid support.