Thread: reading one charechter at a time

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    30

    reading one charechter at a time

    O.k. I found out what is wrong with my program that I am writing but just dont know how to do what i need. I am trying to decode a message. I have the key set up as an array and I have the part setup that will translate the charechters. My problem is that I dont know how to setup the encoded message so that the program only reads it one charechter at a time. i want it to read one charechter then go to the translation part then back to read another charechter and keep doing this until it hits the end of the encoded message. Any help on how to do this would be greatly appreciated.

  2. #2
    Registered User *pointer's Avatar
    Join Date
    Oct 2001
    Posts
    74
    Code:
    //Read one character at a time and print it out.
    #include <iostream.h>
    #include <stdio.h> //required for use of getchar()
    
    int main(void){
        int c;
        cout<<"Enter ctrl+z to quit"<<endl;
        while((c = getchar()) != EOF){ //getchar() reads one character at a time
            cout<<c<<endl;
        }
        return 0;
    }
    pointer = NULL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. time synchronization problem
    By freeindy in forum C Programming
    Replies: 1
    Last Post: 04-19-2007, 06:25 AM
  2. Reading one line at a time...
    By lala123 in forum C Programming
    Replies: 12
    Last Post: 07-08-2005, 09:01 PM
  3. Real time clocks and reading Ports
    By shoobsie in forum C++ Programming
    Replies: 8
    Last Post: 06-21-2005, 12:19 PM
  4. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 07:56 AM
  5. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM