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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:56:11+00:00 2026-05-16T22:56:11+00:00

I am using Visual Studio 2010 Pro for simple C programming, I would like

  • 0

I am using Visual Studio 2010 Pro for simple C programming, I would like to know how I can provide input to the program without having to manually do so. The enviroment I am used to working is your standard commandline Unix enviroment. Once I compile a C file call “inputsInts” it becomes “a.out” and to test input I would type:

The easy way

echo 1 2 3 4| ./a.out //to provide input
The number of ints input was 4 //output

The easier way

more input.txt| ./a.out //to provide input
The number of ints input was 4 //output

The tedious way

./a.out
//now I would manually type
1 2 3 4 s //in this case I have to type a letter to move on
The number of ints input was 4 //output

Hard is how I have to do it in Visual Studio 2010. I would like to be able to just input in an area the input ahead of time or at least have it read a text file. Obviously I can’t test large sets of data by manually typing it in. At the moment I am just doing the coding in VS2010 and going to the unix enviroment to do most testing. I would like to stay in the VS2010 enviroment until I am ready to do a final test in Unix.

I have altered the question quite a bit since I first posted, so the original answers may seem off a bit. Again I appretiate everyone’s time and help.

This is just the simple code for an example:
#include

int main ()  {
    int x, n = 0;
    while (scanf("%d", &x)==1)
        n++;
    printf("The number of ints input was %d\n", n);
    return(0);
}
  • 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-16T22:56:11+00:00Added an answer on May 16, 2026 at 10:56 pm

    You need to create a “Console Application” when you start a new Visual Studio project. This will give you a program that runs from a Windows Command Prompt window, otherwise known as the Cmd window after the name of the shell program that runs underneath it. The command window is located under Programs->Accessories in Windows XP, not sure about other versions of Windows. Once you open a command window, things will work similarly to what you’re used to on Linux.

    cd MyProject
    echo 1 2 3 4|.\MyProject.exe
    MyProject.exe <input.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Visual Studio 2010, I would like to switch over to using InstallShield LE
Using Visual Studio 2010 I would like to do a project level regular expression
Using Visual Basic (and .NET 4) in Visual Studio 2010, I would like to
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
I'm using Visual Studio 2010 Pro against Team Server 2010 and I had my
Using Visual Studio 2010 How can I enumerate all resources within in a specific
I'm using Visual Studio 2010 and I'm putting web browser into my program. So
I created client from wsdl file using visual studio 2010 Pro, created new project,
I'm using 64 bit Windows 7 Pro and Visual Studio 2010 Pro. I'm trying
Using Visual Studio 2010 and .NET framework 4.0 I have built a simple HelloWorld

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.