Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8043991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:05:14+00:00 2026-06-05T05:05:14+00:00

How would I output text one letter at a time like it’s typing without

  • 0

How would I output text one letter at a time like it’s typing without using Sleep() for every character?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:05:15+00:00Added an answer on June 5, 2026 at 5:05 am

    Sleeping is the best way to do what you’re describing, as the alternative, busy waiting, is just going to waste CPU cycles. From the comments, it sounds like you’ve been trying to manually hard-code every single character you want printed with a sleep call, instead of using loops…

    Since there’s been no indication that this is homework after ~20 minutes, I thought I’d post this code. It uses usleep from <unistd.h>, which sleeps for X amount of microseconds, if you’re using Windows try Sleep().

    #include <stdio.h>
    #include <unistd.h>
    
    void type_text(char *s, unsigned ms_delay)
    {
       unsigned usecs = ms_delay * 1000; /* 1000 microseconds per ms */
    
       for (; *s; s++) {
          putchar(*s);
          fflush(stdout); /* alternatively, do once: setbuf(stdout, NULL); */
          usleep(usecs);
       }
    }
    
    int main(void)
    {
       type_text("hello world\n", 100);
       return 0;
    }
    

    Since stdout is buffered, you’re going to have to either flush it after printing each character (fflush(stdout)), or set it to not buffer the output at all by running setbuf(stdout, NULL) once.

    The above code will print "hello world\n" with a delay of 100ms between each character; extremely basic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We would like to mimic taking user input one letter at a time (intended
I would like to insert the output of multiple calculations into my text document:
I'm using an h:outputText to display a value. I would like to limit the
Is there a pretty printing function in Clojure that would output data-structures like lists
I would like to output this jsp in haml: <select> <option ${page.defaultCar==Volvo ? selected
I would like to output debug messages in my django app at different points
I would like to output in this format: e.EE_id e.FNAME e.LNAME SUPer_id s.FNAME s.LNAME
I want PHP to output some text, then sleep for a second and a
I'm using Zend_View to template text email content. However, I've come across one problem
I would like to replace every line that starts with a certain expression (example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.