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

  • Home
  • SEARCH
  • 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 252873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:42:51+00:00 2026-05-11T21:42:51+00:00

I want my program to display the unix windmill while processing. There’s a for

  • 0

I want my program to display the unix windmill while processing. There’s a for loop and in every iteration theres a printf function:

printf("Fetching articles (%c)\r",q);

q is one of the characters in the windmill (-\|/) depending on the iteration number.

The problem is – it seems like in 100 iterations there are only two changes in displayed line, and every iteration takes about one second to complete.

What could be the aouse for this?

Here’s the whole loop with only two possible chars for the windmill:

for (int i=0;i<numb_articles;i++) {
  memset(file_path,0x0,BUFF_SIZE);

  url=article_urls[i];

  if (rules->print!=NO_PRINT) {
    url=modify_url(url,rules->printout,rules->print);
    if (url=="NULL")
      continue;
  }

  get_page(url,file_content);

  if (strcmp(rules->save.data(),"NULL")!=0)
    if (!check_save(rules->save,file_content,url))
      continue;

  at_least_one_saved=true;
  numb_articles_accepted++;

  encoding_list[i]=get_encoding(file_content);

  title=get_title(file_content,err_msg);

  if (title=="")
    continue;

  title_list[i]=strdup(title.data());
  filename=get_filename(title);

  int count=numb_fn_found(filename_list,i,filename.data());
  char *tmp = new char[10];
  if (count>0) {
    sprintf(tmp,"(%d)",count);
    filename.insert((size_t)filename.length(),tmp);
  }

  filename_list[i]=strdup(filename.data());

  char q;
  if (i%2==0)
    q='|';
  else q='-';

  printf("Fetching articles (%c)\r",q);

  ofstream output_file;
  sprintf(file_path,TMP_FILE,filename.data());
  strncat(file_path,".html",5);
  output_file.open(file_path);

  output_file << file_content;

  output_file.close();
}
  • 1 1 Answer
  • 1 View
  • 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-05-11T21:42:52+00:00Added an answer on May 11, 2026 at 9:42 pm

    Flush the output after writing each line:

    printf("Fetching articles (%c)\r",q);
    fflush(stdout);
    

    Without doing this, normally stdout is buffered and only dumps its output when a newline is seen, or its internal buffer fills up.

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

Sidebar

Ask A Question

Stats

  • Questions 222k
  • Answers 222k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Cookies basically work like this: to set a cookie, the… May 13, 2026 at 12:22 am
  • Editorial Team
    Editorial Team added an answer If you have Python 2.6 you have the math.isnan() function… May 13, 2026 at 12:22 am
  • Editorial Team
    Editorial Team added an answer Use double quotes to pass the entire path as the… May 13, 2026 at 12:22 am

Related Questions

I want my program to display the unix windmill while processing. There's a for
How can I execute SQL statements from a C program. For example I want
I want to output the value of a double in it's full precision. However,
Background I have a MacAlly IceKey keyboard. This keyboard has volume buttons that require
I actually have 2 queries: How do I display the data of a variable

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.