🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9666

Write String Array to File

#9666
From: Keith Underwood
Date: Sat, 12 Feb 2000 00:00
30 lines
1748 bytes
I have a string array person[][] and have first names and last names in
the array.
How od I write the entire array to file.  I can get it to write the last
set of names but I can't get it to write all of them
I pass in the entire array but can't get the whole thing to file.

  public void createFile(String[][] sa)
  {
    File myFile = new File("c:\\kau\\myfile.txt");
    String[][] personal = new String[3][3];
    personal = sa;
    String myString = personal[0][0] + " " + personal[1][0] + " " +
                      personal[2][0];

    try
    {
       FileOutputStream fos = new FileOutputStream(myFile);
       byte[] buffer = new byte[1024];
       //buffer = personal.getBytes();
       buffer = myString.getBytes();
       fos.write(buffer);
       System.out.println("File created: " + myFile);
    }
    catch (IOException e)
    {
      System.out.println("Bad File Creation -- " + myFile + " " + e);
    }
  }

Keith
Technical Details
Message-ID: <38A5F0FD.BEC2F9D3@gte.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,e1c31422adb6dd66,start
X-Google-Attributes: gid111d45,public
From: Keith Underwood <keithu@gte.net>
Subject: Write String Array to File
Date: 2000/02/12
Message-ID: <38A5F0FD.BEC2F9D3@gte.net>
X-Deja-AN: 585145281
Distribution: world
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
X-Complaints-To: abuse@gte.net
X-Trace: /bdhN9Vxz/WmR5zcE4hjV7blOqj75MkWOuU/BmRQY0RVfEX6ANJjDexYCf3zbhsQHHl+JdFVWVKo!1WicRYewFIEU06Jgig4BJSq8f1egPx0vec33gmw6xODCJy14PpBey8eRDQ==
MIME-Version: 1.0
NNTP-Posting-Date: Sat, 12 Feb 2000 23:54:19 GMT
Newsgroups: borland.public.jbuilder.java.swing