CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008

    Need some help with char reading...

    Im making a program in C++ and i need a little help. Ita my first semester in C++ so im still kind of a noob, but i dont remember how to get a while statement to continuosly read from a string until there are no more characters, as well as terminate the loop once the string is read. Basically the program is designed to use an end of line loop that continues to get roman nemeral characters from the user and convert them until the user hits enter. Any help is appreciated =)

  2. #2
    Join Date
    Jun 2002
    Stockholm, Sweden

    Re: Need some help with char reading...

    Use strlen() to get the string length. This is the number of times you should loop.

    Or, if you want to stop at newline instead:
    char c, *p=str;
    while((c=*p++) != '\n') {
    Nobody cares how it works as long as it works

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.