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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:01:16+00:00 2026-06-13T09:01:16+00:00

I am writing a program that reads input from one file, then the program

  • 0

I am writing a program that reads input from one file, then the program would formate the data and write it to a different file.

Input file:

Christopher kardaras,10 N Brainard,Naperville,IL,60566 George
Washington,30 W Jackson,Chicago,IL,60060

Output file:

Christopher kardaras 10 N Brainard Naperville, IL 60566

George Washington 30 W Jackson Chicago, IL 60060

when I run the code the output does not show in the output file, the following is my code.

    //open input, output files
    FileReader freader = new FileReader("AddressData.txt");
    BufferedReader inFile = new BufferedReader(freader);

    FileWriter fwriter=new FileWriter("FormattedData.text");
    PrintWriter outFile= new PrintWriter (fwriter);

    //process data - get a line, separate into fields, then print
    //address label to the output file

    line= inFile.readLine();
    while (line != null)
    {
        //Create a new scanner, use comma as field separator
        Scanner s = new Scanner(line).useDelimiter(",");

        // SOME CODE OMITTED HERE FOR BREVITY
        out.printf(...);

        //get the next line. read failure (EOF) will exit the loop
        line = inFile.readLine();
    }

    //clean up
    inFile.close();
    outFile.close();
  • 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-13T09:01:17+00:00Added an answer on June 13, 2026 at 9:01 am

    Try flushing the outFile before closing it.

    outFile.flush();
    

    You can also use the alternative PrintWriter constructor that takes care of that for you:

    public PrintWriter(OutputStream out, boolean autoFlush)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program that reads the input from a file and then
I am writing a program that reads data packets from a file, and assigns
I am writing a function for my Clojure program that reads user input from
I am writing a simple shell program that must take input from a file
I'm writing a program that reads huge file (3x280 GB) and does a fitting
I'm writing a program that lets the user input 6 temperature readings, and then
I'm writing a small program in C that will read input from the console.
I have to write a program that read from a file that contains the
I'm writing a MATLAB program that reads in a title from the user to
I'm writing a program that will guess words taken from a big text file.

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.