I'm trying to save fixed length data into a random access file. Right now it works,
but saves everything in one, continuous line. How can save every new entry in
a new line. Also, I want to separate fields with a "|" character in order to read the file into a JTable.
i.e:
Id|Name|City|Phone
102|Beth Reiser|New York|(212)5558725
111|Dylan Ricci|Syracuse|(315)5554486
116|Brian Gugliuzza|Mamaroneck|(914)5553817
120|Gertrude Stein|Elmsford|(914)5553476
131|Daljit Sinnot|Bohemia|(516)5559811 - public void writeDetails() {
-
-
try {
-
-
patient a = new patient();
-
-
a.patName = name.getText();
-
a.patSurname = surname.getText();
-
a.patDob = dobInput.getText();
-
a.patAddress = addInput.getText();
-
a.patEmgNum = emgInput.getText();
-
a.patCheckInDate = dateInput.getText();
-
a.patCheckInTime = timeInput.getText();
-
a.patWard = (String)wardCombo.getSelectedItem();
-
a.patDoctor = (String)doctorCombo.getSelectedItem();
-
-
raf.seek(raf.length());
-
FixedLengthStringIO.writeFixedLengthString(a.patName, NAME_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patSurname, SURNAME_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patDob, DOB_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patAddress, ADD_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patEmgNum, EMG_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patCheckInDate, DATE_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patCheckInTime, TIME_SIZE, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patWard, 20, raf);
-
FixedLengthStringIO.writeFixedLengthString(a.patDoctor, 30, raf);
-
-
JOptionPane.showMessageDialog(null, "PATIENT DETAILS SAVED", "INFORMATION", JOptionPane.INFORMATION_MESSAGE);
-
-
} catch (IOException ex) {
-
-
ex.printStackTrace();
-
-
}
-
}
1 2043
Please use code tags around your code snippits.
Why don't you just add a new line between every entry? "\n"
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chris Lasher |
last post by:
Hello,
I have a rather large (100+ MB) FASTA file from which I need to
access records in a random order. The FASTA format is a standard format
for storing molecular biological sequences. Each...
|
by: Dr John Stockton |
last post by:
Q1 :
Given an array such as might have been generated by
var A =
is there a highly effective way of reducing it to - i.e.
removing the undefineds and shifting the rest down?
...
|
by: Tlaker |
last post by:
MS Works 6.0 to Access 2000. Tried saving to *.csv and dbf as well as
converting to Excel then loading but to no avail. My Works database has
about 4000 records, each with about 30 fields. Is...
|
by: tshad |
last post by:
I am trying to set up an Image authorization where you type in the value
that is in a picture to log on to our site.
I found a program that is supposed to do it, but it doesn't seem to work.
...
|
by: Kza |
last post by:
Hi, I am currently using xerces sax parser for c++, (I use DOM too, but
I think SAX is more relevant here) for processing and displaying fairly
large xml files. Usually I give xerces a filename,...
|
by: Jimmy |
last post by:
ill have a database with 1 table and 3 fields:
ID FIRSTNAME LASTNAME
(the ID field will be the auto incrementing index)
there might be 10 records in the DB, there might be 10,000.
i...
|
by: Kevin Williamson |
last post by:
Hi,
I've written a lottery programme in PHP that selects 10 winners a week
from approximately 18,000 shares.
The problem I have is that of the ten winners one week the same share
number was...
|
by: castironpi |
last post by:
I'd like to seriously nominate this idea and get a considered opinion
on it.
struct.Struct lets you encode Python objects into structured memory.
It accepts a format string, and optionally a...
|
by: MiziaQ |
last post by:
I'm trying to save fixed length data into a random access file. Right now it works, but saves everything in one, continuous line. How can save every new entry in a new line. Also, I want to separate...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |