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 6701311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:55:09+00:00 2026-05-26T06:55:09+00:00

I am supposed to use a for loop for use input -Not sure why

  • 0

I am supposed to use a for loop for use input
-Not sure why a for loop? I mean all this program does is keep on asking the user to input a filename, a starting seek adds and the # of bytes to read off.

For example, the input should look like:

%myprog
Enter filename:datafile
Start seek:0
Bytes to read:65

My block size in this program is 20, so the output would be:

“m/n/files/program/test/datafile” block 0 read – 20 bytes
01234567890123456789
“m/n/files/program/test/datafile” block 1 read – 20 bytes
01234567890123456789
“m/n/files/program/test/datafile” block 3 read – 20 bytes
01234567890123456789
“m/n/files/program/test/datafile” block 0 read – 5 bytes
01234

So I am not sure why/how I would use a for loop to ask for user input. All we are doing is keep on asking the user to enter different files and seek ranges. The assignment does not say where to stop asking.

  • 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-05-26T06:55:09+00:00Added an answer on May 26, 2026 at 6:55 am

    The for loop is the universal looping construct in C.

    The following loops are equivalent.

    FOR LOOP

    int n;
    for(n = 0; n < 10; n++) {
      foo(n);
    }
    

    WHILE LOOP

    int n;
    n = 0;
    while(n < 10) {
      foo(n)
      n++;
    }
    

    Assuming you know this, you could write the following rather obtuse code, although it might be frowned upon:

    #include <stdio.h>
    int main(void) {
      char resp[BUFSIZ];
      for(scanf("%s", resp) ;
          strcmp(resp,"done") != 0 ;
          scanf("%s", resp) {
        printf("%s\n", resp);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My program is supposed to tally up bottles from 4 rooms. When the user
i use this loop to extract images from articles to put it in image
I am supposed to write a program that asks the user for a positive
This program is supposed to judge the height of multiple buildings by the type
How am I supposed to use merge with the latest version of Tortoise SVN?
I'm supposed to use Amazon s3 in my application to upload/download files. Can anyone
I am supposed to use pointers to swap ints in an array. It compiles
Which one am I supposed to use when I need to supply a credential
I know that I am supposed to use delete [] after I use new
Unless I am doing something wrong, the way I am supposed to use ConfigurationSection,

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.