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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:49:52+00:00 2026-05-21T04:49:52+00:00

I have a program written in Fortran by someone else which consequently reads a

  • 0

I have a program written in Fortran by someone else which consequently reads a few things from the standard input and then does some calculations and outputs the result. What I want to do is to run it many times with different input data from another program, written in C by me. To do this I use popen:

  FILE *pipe = popen(".\\program.exe", "wt");
  if (!pipe) {
    exit(1);
  }

  fprintf(pipe, "%d\n", thing1);
  fprintf(pipe, "%d\n", thing2);
  ...

  pclose(pipe);

The problem is that it doesn’t work this way. It works perfectly with “program.exe < input.txt” but not this way. It reads the first thing and then outputs this stupid error: “IO-09 system file error – unknown error”. Of course I have no idea what this means as I’ve never programmed Fortran.

What am I doing wrong?

EDIT:

Unfortunately I have no source code of that program

  • 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-21T04:49:53+00:00Added an answer on May 21, 2026 at 4:49 am

    It looks like it should work, not sure why it doesn’t. Are you sure
    popen() is available on your Windows machine? I vaguely recall it
    not being available for some Windows systems. You could try it with a
    simple C program and see if it’s popen() or the Fortran program.

    As a workaround, you could write your data to a temporary file, then
    use system(".\\program.exe < tempfile") to call the Fortran program.
    Yeah, it’s a kludge.

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

Sidebar

Related Questions

I have a bash script that runs a simulation program written in Fortran 90,
I have a program (written in C#) that reads/writes its data directly (direct file
I have a program written in C++ which does some computer diagnostics. Before the
I have a program written in C#. I want the Timer class to run
I'm new to C++, this is my first week since the upgrade from fortran.
I am not a Fortran programmer (just a short experience), but I need to
I just started working on Python and have been trying to run an outside
Although I found many answers and discussions about this question, I am unable to
Please advise. I am a lawyer, I work in the field of Law Informatics.
Greeting Everyone I'm trying to compile and run a multi-language code in C, C++

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.