From c70f1357108f07164a7b63019f13b665ff660012 Mon Sep 17 00:00:00 2001 From: Brad Arant Date: Wed, 13 Nov 2024 08:54:09 -0800 Subject: [PATCH] Modified nextChar method to return character under cursor before incrementing cursor. --- ZString.cpp | 8 +++++--- ZString.h | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ZString.cpp b/ZString.cpp index b9a0e58..9585b6f 100644 --- a/ZString.cpp +++ b/ZString.cpp @@ -561,9 +561,11 @@ namespace coreutils { return *this; } - void ZString::nextChar() { - if(!eod()) - ++cursor; + char ZString::nextChar() { + char temp = 0; + if(!eod()) + temp = *cursor++; + return temp; } } diff --git a/ZString.h b/ZString.h index c5b5c80..c844540 100644 --- a/ZString.h +++ b/ZString.h @@ -419,10 +419,11 @@ namespace coreutils { bool ifCRLF(); /// - /// + /// Returns the character at the cursor and advances the cursor one + /// position until end of data. /// - void nextChar(); + char nextChar(); /// ///