Solved

Create text file

Posted on 2002-05-27
45
414 Views
Last Modified: 2008-02-01
I have a program for booking sessions for members at a local club.  The entries are member no. (checked for validity against an existing text file) and the session length (X hours).  The cost is calculated and added to a running total of booked sessions.

I would like the program to create a text file (seperated by tab characters) to include:

date of booking (current date at time of booking)
member no.
session length
cost of session
running total

that will be added to each time a session is booked via a save button.

I'm working with TextFileWrite, but not doing very well!  Help would be much appreciated.

LRH

P.S.  I'm not using Swing.
0
Comment
Question by:LittleRedHat
  • 24
  • 17
  • 4
45 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7037980
You could use something like the following to append an entry to your text file:

public void addEntry(Date d, int memberno, int total)
{
   FileOutputStream fout = new FileOutputStream("stuff.txt", true);
   PrintWriter out = new PrinterWriter(new OutputStreamWriter(fout));
   out.println(d+"\t"+memberno+"\t"+total);
   out.close();
}
0
 
LVL 92

Expert Comment

by:objects
ID: 7037982
What are the problems you are currently having?
0
 

Author Comment

by:LittleRedHat
ID: 7038101
Don't know what I'm doing!!! :-D

This is only my second Java program and I'm learning as I go along. I'm also working the program in a window and keep tripping up over the Listeners! Without a model to work from my guess work isn't too good, so many thanks for the starter code. But am I right in thinking it's code for adding to an existing file?  The file I want to create and then add to will be a new file ... the existing file I'm reading from has a different content (no./name/type of membership/expiry date/etc.).

Trying to work out how I might do it I picked up on FileWrite (seemed logical as I'm using TextFileRead) and understand I need to do some "buffering" along the way, but haven't sussed out how to put it all together.

I hope this explains things a bit more clearly.  I can include my existing code if that would be useful, but it's quite long.

With thanks again.

LRH

P.S. Again!  Does +"\t"+ represent tabs?  I thought I had to use # .
0
 

Author Comment

by:LittleRedHat
ID: 7038157
After thoughts!

I'm not at the moment wanting to print out the file, just create it on disc.

And if all goes temporarily quiet at my end, it's just that I've run out of "midnight oil" and fallen asleep over the keyboard! :-)

LRH
0
 
LVL 92

Expert Comment

by:objects
ID: 7038191
> But am I right in thinking it's code for adding to an
> existing file?

It is, but if the file does not exist then it will create one. So it'll handle both cases.

> Does +"\t"+ represent tabs?  I thought I had to use # .

yes

> I'm not at the moment wanting to print out the file,
> just create it on disc.

The println method doesn't print out, it writes to disk as you require.

0
 

Author Comment

by:LittleRedHat
ID: 7038205
Thanks again.  Think I'd best get some sleep now.  I'll start working on it in the morning and will let you know how I get on.

Hope the rest of your day goes well. :-)

LRH
0
 

Expert Comment

by:MikaelHK
ID: 7038842
It might seem rather simplistic, but you could consider to do the following:

public File createFile( String strPath )
{
   File f = new File( strPath );
   f.createNewFile();
   return f;
}

This will create the empty file for you to work with.
Now to write to it:

NB: I assume that the string with the data was created before hand. In fact it would be useful to create and open the OutputStreams and keep them over time if you're insert stuff in bulk.

public void writeToFile( File f, String strData )
{
   FileOutputStream fos = new FileOutputStream( f );
   BufferedOutputStream bos = new BufferedOutputStream( fos );
   PrintWriter out = new PrintWriter( bos );
   out.println( strData );
   out.flush();
   out.close();
}
0
 
LVL 92

Expert Comment

by:objects
ID: 7038850
MikaelHK,
Exlicitly creating the file is unnecessary, as it is handled automatically by FileOutputStream?

0
 

Expert Comment

by:MikaelHK
ID: 7038861
I have experienced that, but he explicitly asked for the creation of the file seperately to my understanding, so I showed how. No offense intended.
0
 

Author Comment

by:LittleRedHat
ID: 7038944
Just about to start work, but picked up the email notifications first.  Thanks for the interest and help.

Sorry for any confusion re: creating the file.  At present I have the file I'm reading from on disc.  I want a new (starting from now)seperate file to keep a record the bookings.  I need the program to provide the date of the booking, which will be the current date at the time of the booking.  The user types in the member no. and then selects the hours from a choice/dropdown box and hits the calculate button.  The program then calculates the cost of the session and the running total of all the sessions booked.

Just in case it will help (with apologies for the length and needs tidying up kindergarten coding) I'll attach my program.

Whilst I'm here, please could I ask an extra favour if you have the time to spare?  (I'm following your advice, but would like to make sure I'm understanding.) You're both using FileOutputStream.  I assume that's better than my thoughts to use FileWrite.  What's the difference/benefit and what does BufferedOutputStream actually do?

Will now try to do something other than ask questions! :-)

Regards.

LRH

/*
      Session Costing Window using AWT classes
*/
import java.awt.*;
import java.awt.event.*;
import java.util.StringTokenizer;
import java.text.*;      //for date
import java.util.*;      //for date

public class SessionWindow extends Frame implements ActionListener, FocusListener{
      private int recNum, numOfRecs;
      private double rTotal;
      private Session mt;        //use SessionType as locer not known until selected
      private TextField txtMemNum, txtTime;
      private Label lblMemDets, lblSessTime, lblCost, lblOutOfDate, lblRunTotal;
      private Choice pickTime;
      
      private TypePremium[] tp = new TypePremium[25];       //array of product details
      
      RunningTotal rt = new RunningTotal();

      public SessionWindow(String title){
            super(title);            //add title to window bar
            setBackground(new Color(0xd9,0xeb,0xeb));
            addWindowListener(new WindowEventListener()); //ensure window events are used
            setLayout(new FlowLayout(FlowLayout.RIGHT, 30, 10)); //set default positioning
            
            Label lblMember = new Label("Member number"); //add components
            add(lblMember);

            txtMemNum = new TextField("", 5);
            add(txtMemNum);
            txtMemNum.addFocusListener(this); //check when focus is changed to text box (ist FocusListener)

            lblMemDets = new Label("");
            add(lblMemDets);

            lblOutOfDate = new Label("");
            add(lblOutOfDate);

            Label lblSessTime = new Label("How many hours?");
            add(lblSessTime);

            pickTime = new Choice();
                  pickTime.addItem("0");
                  pickTime.addItem("1");
                  pickTime.addItem("2");
                  pickTime.addItem("3");
                  pickTime.addItem("4");
                  pickTime.addItem("5");
                  pickTime.addItem("6");
                  pickTime.addItem("7");
                  pickTime.addItem("8");
                  add(pickTime);

            lblCost = new Label("Cost = ");
            add(lblCost);

            lblRunTotal = new Label("Total sessions cost = ");
            add(lblRunTotal);

            Button cmdCalcCost = new Button("Calculate Cost");
            add(cmdCalcCost);
            cmdCalcCost.addActionListener(this); //listen for button clicks

            recNum = 0;
            LoadArray();
      }

      public void LoadArray(){
            TextFileRead tf = new TextFileRead("memberDetails.txt", 25);      //set-up file for reading
            String sArray[] = new String[25];
                  
            sArray = tf.ReadTextLines();                              //load String array from file
            numOfRecs = tf.NumberOfLinesRead();
            for(int i = 0; i < numOfRecs; i++)      //separate String into tokens
                  parseLine(sArray[i], i);
      }

      private void parseLine(String s, int record){      //separate string into fields
            StringTokenizer st = new StringTokenizer(s, "\t");
            
            int mN=Integer.parseInt(st.nextToken());
            String fN=st.nextToken();
            String sN=st.nextToken();
            String mT=st.nextToken();
            String eD=st.nextToken();
                  
            tp[record]=new TypePremium(mN, fN, sN, mT, eD);
      }
      public int FindSession (int mn){
            for(int i=0; i < numOfRecs; i++)
                  if (tp[i].GetMemNum() == mn) return i;
            return -1;
      }
      
      public void focusGained(FocusEvent e){      //initialise when focus is on text box
            txtMemNum.setText("");
      
            lblMemDets.setText("----------------------------------------------------------------------------------------");
            lblOutOfDate.setText("");
            lblCost.setText("Cost = #0.00");
            show();
      }

      public void focusLost(FocusEvent e){ //output member details when focus lost
            recNum = FindSession(Integer.parseInt(txtMemNum.getText()));
                  if(recNum >= 0){
                        lblMemDets.setText(tp[recNum].toString());
                        
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
            String expDate = tp[recNum].GetExpDate();
            Date ed = sdf.parse(expDate, new ParsePosition(0));
            Date now = new Date();
                  if (ed.after(now))
                        lblMemDets.setText(tp[recNum].toString());
                  else
                        lblOutOfDate.setText("--Sorry, date expired --");
                        show();

                              }
                              else
                              lblMemDets.setText("------------- Sorry, this is not a current member number -------------");
                        show();
            }
                  
public void actionPerformed(ActionEvent e){ //process button clicks

            String arg = e.getActionCommand();

             int loc = FindSession(Integer.parseInt(txtMemNum.getText()));
            if("Calculate Cost".equals(arg) && loc >= 0){

            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
            String expDate = tp[recNum].GetExpDate();
            Date ed = sdf.parse(expDate, new ParsePosition(0));
            Date now = new Date();

                  if (ed.after(now)){
                        lblMemDets.setText(tp[recNum].toString());

      if(tp[loc].GetMemType().equals("Prem"))
                        mt = new TypePremium(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                              tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());
                  else if(tp[loc].GetMemType().equals("Std"))
                        mt = new TypeStandard(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                              tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());
                  else
                        mt = new TypeCasual(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                              tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());

              double cost = mt.calcCost(Integer.parseInt(pickTime.getSelectedItem()));  //use polymorphism

            rt.InputValue(cost);
                  rTotal=rt.RunningTotal();            

            java.text.NumberFormat nf = java.text.NumberFormat.getNumberInstance();
            nf.setMinimumFractionDigits(2);
                  
            lblCost.setText("Session Cost = #" + nf.format(cost)); //output session cost
                        show();

            lblRunTotal.setText("Total Sessions Cost = #" + nf.format(rt.RunningTotal())); //output running total
                        show();
            }

      }      

     }

}

0
 

Expert Comment

by:MikaelHK
ID: 7038964
Well the BufferedOutputStream thing I can answer :)
Buffering is often used in Java to increase the speed of both reading and writing. It collects the input you put into a stream and commits it collectively to the underlying stream. It in my experience always improves IO performance on larger amounts of data. Now you´re commiting single lines at a time and as such that might be a case where a buffer is overkill, but it is good to know. It is one of those basic performance tips aside from avoid doing:

 String str = "bla bla";
 str += " bla bla";
 .
 .
 .
 str += "bla "+ 1;

This is also a very bad thing. (the right way is to use a StringBuffer object and append the data one by one much faster).
0
 

Author Comment

by:LittleRedHat
ID: 7038987
Very many thanks for that ... much appreciated.
0
 

Author Comment

by:LittleRedHat
ID: 7039434
Thought I was rolling, but :-(

Imported java.io.*;

Used ...  
     public void addEntry(Date now, int MemNum, double cost, double rTotal){
     FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
     BufferedOutputStream bOut = new BufferedOutputStream( fOut );
     PrintWriter out = new PrintWriter(bOut);
     out.println(now+"\t"+MemNum+"\t"+cost+"\t"+rTotal);
     out.flush();
     out.close();
}

Got error ...
unreported exception java.io.FileNotFoundException; must
 be caught or declared to be thrown
        FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
                                ^

Have tried creating an empty file first (got that wrong several times over and have abandoned for the moment!) and am now stuck for new ideas to try.  

Am enjoying trying Java, but am still spending a lot of time on the outside looking in ... as you can see!! Any further help will be very gratefully received.

WTA

LRH
0
 

Expert Comment

by:MikaelHK
ID: 7039461
Well quite simply you need to wrap the code in this:

try
{

}
catch( FileNotFoundException fnfe )
{
 fnfe.printStackTrace();
}
catch( IOException ioe )
{
 ioe.printStackTrace();
}
0
 

Author Comment

by:LittleRedHat
ID: 7039504
Just trying to back track here.  I had another idea, but made matters worse.
0
 

Author Comment

by:LittleRedHat
ID: 7039510
Thanks for staying with me.
0
 

Author Comment

by:LittleRedHat
ID: 7039630
Thanks! That's great.  It's now compiling. :-)

Please forgive me if I'm being a nuisance, but I'm trying to,understand what's happening ... it's the way I was brought up!

I've slotted everything in here ...

     lblRunTotal.setText("Total Sessions Cost = £" + nf.format(rt.RunningTotal())); //output running total
                    show();
          }
XXXXXXXXXXXX new code here XXXXXXXXXXXX
       }          
   }
}

as I want it to write to the new "bookings" file after cost/running total have been calculated.  Is this the right place?

I've run the program, but it doesn't appear to be doing anything.  Do I need a save button?  

And again if you've time please could you explain the new code.  I understand that it's using "exceptions" for if the file isn't found, but am not sure about "StackTrace" ... and should I have imported java.io.IOEception?

Hope you're not wishing you hadn't picked up on my question!

With many thanks.

LRH
0
 

Author Comment

by:LittleRedHat
ID: 7039663
A little temporary peace and quiet for you. Have to go and feed the family!!!!!!!!!

0
 

Author Comment

by:LittleRedHat
ID: 7040430
I've spent the past 3 hours trying to get the program to work, but I'm still in a muddle.  It's sure to be my fault, but I'm lost.


0
 
LVL 92

Expert Comment

by:objects
ID: 7040515
>  Is this the right place?

Looks about right.

> Do I need a save button?  

No, looking at your code it should append to the file when you hit the 'Calculate Cost' button.

> but am not sure about "StackTrace"

A stack trace is just the chain of method calls that had been made when the exception was thrown. It doesn't affect your programs functionality, it is just useful for debugging.

> and should I have imported java.io.IOEception?

You already do with:
import java.io.*;
0
 

Author Comment

by:LittleRedHat
ID: 7040556
Hi Objects,

Guess it's "good morning" to you. :-))

Even if it's not working, at least knowing I haven't got everything totally wrong has really cheered me up. Thanks.  

What is puzzling me is that you said the code should create the file if it couldn't find it, but the compiler wont accept it.  (I'm not very clued up about exceptions.)  Then when I include the extra code it compiles, but I can't find any evidence of it having saved the info/any info to the file.  I've even created an empty bookings.txt file in the directory in the hopes it would "light the way"!!!

> but am not sure about "StackTrace" ... can I just take out those lines?

I hate to be such a trouble, but I've spent hours and hours getting my program so far and think I've exhausted my grey cells in the process!  I just can't get my head around this, hence the ongoing pleas for help to get me through this last mile.

Regards.

LRH
0
 
LVL 92

Expert Comment

by:objects
ID: 7040580
> What is puzzling me is that you said the code should
> create the file if it couldn't find it, but the
> compiler wont accept it.

The compile failed becuase the FileInputStream is defined to throw the FIleNotFoundException (have a look at the javadoc for details of what exceptions are thrown). It throws this if it cannot create the file for some reason, or the file is a directory.

To check why it's not working try putting some debug around the code that writes the entry so you can see if that code is actually getting run. Something like:

System.out.println("About to write entry");

This output will come up in the Java console.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:LittleRedHat
ID: 7040617
Just tried your idea, but I'm still getting the single, same FIleNotFoundException error.  Think though I might have done it wrong ... as everything's running in a window I don't know how to run it in command prompt.

I've even tried taking out [now+"\t"+MemNum+"\t"+] as I wasn't sure whether "now" would pick up the date and whether I needed to reference the MemberNo to the existing read in file.  That just left "cost and r/Total" as straight forward variables ... anything to try just in case!  Though as these occur after the (non) event, I wasn't surprised it didn't work miracles. :-)
0
 
LVL 92

Expert Comment

by:objects
ID: 7040623
Is this an appet? If so exactly how are you running it.
Applets, by default, are not allowed to access the local hard disk.
0
 

Author Comment

by:LittleRedHat
ID: 7040632
No, it's not an applet.
0
 
LVL 92

Expert Comment

by:objects
ID: 7040656
ok and do you have permission to create the file in the directory you are running the program?

Can you post the current state of your file writing code.
0
 

Author Comment

by:LittleRedHat
ID: 7040672
I have permission.

I'm testing out ideas on these three variations ...

1.)

public void addEntry(Date now, int MemNum, double cost, double rTotal){
     FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
     PrintWriter out = new PrintWriter(new OuputStreamWriter(fOut));
     out.println(now+"\t"+MemNum+"\t"+cost+"\t"+rTotal);
     out.close();
}          

2.)

 public void addEntry(Date now, int MemNum, double cost, double rTotal){
     FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
     BufferedOutputStream bOut = new BufferedOutputStream( fOut );
     PrintWriter out = new PrintWriter(bOut);
     out.println(now+"\t"+MemNum+"\t"+cost+"\t"+rTotal);
     out.flush();
     out.close();
}

3.)

     public void addEntry(Date now, int MemNum, double cost, double rTotal){

     try {
     FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
     BufferedOutputStream bOut = new BufferedOutputStream( fOut );
     PrintWriter out = new PrintWriter(bOut);
     out.println(now+"\t"+MemNum+"\t"+cost+"\t"+rTotal);
     out.flush();
     out.close();
         
          }
          catch( FileNotFoundException fnfe )
          {
          fnfe.printStackTrace();
          }
          catch( IOException ioe )
          {
          ioe.printStackTrace();
          }
}          
0
 
LVL 92

Expert Comment

by:objects
ID: 7040698
1. & 2. won't compile because you're not handling the exceptions. Exceptions need to be caught, or 'passed' up to the calling method by declaring them as being thrown.

When you run 3. is it throwing a FileNotFoundException?
0
 

Author Comment

by:LittleRedHat
ID: 7040712
3 compiles without errors.  The program runs without errors, but I can't find any evidence of it having created/written to a file.  (Have tried a bookings.txt system search) When I create a blank bookings.txt file in the directory in which the program is running, it doesn't write to that either.
0
 
LVL 92

Expert Comment

by:objects
ID: 7040717
Sorry, I thought you said above that it was throwing a FileNotFoundException.
Creating an empty file won't make any difference as it will get created anyway if it doesn't exist.

Sounds like the method's not getting called. Put some debug code in as I suggested above:

public void addEntry(Date now, int MemNum, double cost, double rTotal){

    System.out.println("Calling addEntry");

    try {
    ....

Do similiar in other places to work out what getting called and whats not.
   
0
 

Author Comment

by:LittleRedHat
ID: 7040723
So very sorry :-(  Having worked through 1,2 & 3 ... when 3 compiled but didn't come up with the goods I started going through them all again to see if I could see if I had made any errors ... I'm afraid you came back in just as I'd cycled back again to 1.

Thanks for the code suggestions ... I'm away to try ...
0
 

Author Comment

by:LittleRedHat
ID: 7040733
Have done as you said with (3).  It just compiles.

>> Sounds like the method's not getting called
I had wondered about this, hence my question about if it's in the right place.  I have been thinking perhaps I need to insert it earlier in the program and then call it at the end of the ActionPerformed, but haven't worked out how.
0
 
LVL 92

Expert Comment

by:objects
ID: 7040753
The point of the debug code was to check whether it was being called or not. Does the debug get printed out when it runs?

When do you actually call the addEntry() method?
0
 

Author Comment

by:LittleRedHat
ID: 7040777
The debug doesn't get printed.

I have been trying to call it after the cost and running total have been calculated.  I've just been using addEntry();  I guess this wrong?
0
 
LVL 92

Expert Comment

by:objects
ID: 7040790
Show me the code for the method that calls it.
0
 

Author Comment

by:LittleRedHat
ID: 7040804
public void actionPerformed(ActionEvent e){ //process button clicks

          String arg = e.getActionCommand();

           int loc = FindSession(Integer.parseInt(txtMemNum.getText()));
          if("Calculate Cost".equals(arg) && loc >= 0){

          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
          String expDate = tp[recNum].GetExpDate();
          Date ed = sdf.parse(expDate, new ParsePosition(0));
          Date now = new Date();

               if (ed.after(now)){
                    lblMemDets.setText(tp[recNum].toString());

     if(tp[loc].GetMemType().equals("Prem"))
                    mt = new TypePremium(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                         tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());
               else if(tp[loc].GetMemType().equals("Std"))
                    mt = new TypeStandard(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                         tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());
               else
                    mt = new TypeCasual(tp[loc].GetMemNum(), tp[loc].GetFirstName(),
                         tp[loc].GetSurName(), tp[loc].GetMemType(),tp[loc].GetExpDate());

            double cost = mt.calcCost(Integer.parseInt(pickTime.getSelectedItem()));  //use polymorphism

          rt.InputValue(cost);
               rTotal=rt.RunningTotal();
         
          addEntry();
         
          java.text.NumberFormat nf = java.text.NumberFormat.getNumberInstance();
          nf.setMinimumFractionDigits(2);
               
          lblCost.setText("Session Cost = £" + nf.format(cost)); //output session cost
                    show();

          lblRunTotal.setText("Total Sessions Cost = £" + nf.format(rt.RunningTotal())); //output running total
                    show();

I've just moved "addEntry();" up above the labels.  The re-compiled produced ...

addEntry(java.util.Date,int,double,double) in SessionWin
dow cannot be applied to ()
                addEntry();
                ^

I'm struggling to stay on line here. My ISP is seems to be having problems.  If I do get totally cut-off, I'll be back as soon as possible.

With ongoing thanks.

LRH

0
 
LVL 92

Expert Comment

by:objects
ID: 7040808
You need to pass the required parameters in the call to addEntry.
0
 
LVL 92

Expert Comment

by:objects
ID: 7041092
Something like:

addEntry(now, MemNum, cost, rTotal);

0
 

Author Comment

by:LittleRedHat
ID: 7041502
Back online!  At least the breakdown gave me chance to get some sleep ... I needed that.

I can't believe how thick I'm being over all this, but I am trying to get my brain back into gear.  Following Objects last two comments, I'm now thinking I need to somehow code ...

public void addEntry(String bookingDetails); and set up

bookingDetails = ( now, MemNum, etc. as a string)

but unfortunately my brain hasn't taken me far enough to see how I can pull in the details as a tab seperated string.

All and every suggestion is sooooo appreciated.

LRH
0
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 7043253
Personally I'd pass the individual entries to addEntry() and have it construct the string. Reason being that if you decide to change how the data is stored then its all handled in one method. Imagine if addEntry() was being called from many places. But thius is just me being pedantic :-)

To contruct your string you can just do:

bookingDetails = now+"\t"+memNum+"\t"+  etc
0
 

Author Comment

by:LittleRedHat
ID: 7043321
Hi Miracle Worker,  :-)))

That was a great suggestion.  

After changing the coding to ...

FileOutputStream fOut = new FileOutputStream("bookings.txt", true);
     BufferedOutputStream bOut = new BufferedOutputStream( fOut );
     PrintWriter out = new PrintWriter(bOut);
     out.println(bookDets);

and ... addEntry(bookDets);

I spent today trying, without success, to fathom out how to convert asstd type data from asstd sources into a string.  I didn't need to make it so complicated.  Your way works.  It can't resolve MemNum so I've taken that out for now, but EVERYTHING ELSE HAS WRITTEN TO FILE. :-)))  All I now have to do is to get it to trace the member number.

... And there was me planning on leaving you in peace tonight!  A million thanks for all your time and trouble and for not giving me up as a lost cause.  I've just upped the points for you on this one.

Yippee!

0
 
LVL 92

Expert Comment

by:objects
ID: 7043344
Happy to help :-)
0
 

Author Comment

by:LittleRedHat
ID: 7043381
You've given me so much help it's going to be a case of metaphorically closing my eyes and sticking a pin in to chose which comment to accept!

With forever thanks and all best wishes ...

LRH

Yippee! Yippee! Yippee! Yippee! Yippppppeeeeeeeee! :-)))
0
 
LVL 92

Expert Comment

by:objects
ID: 7043393
No worries :-)

http://www.objects.com.au/staff/mick
Brainbench MVP for Java 1
http://www.brainbench.com
0
 

Author Comment

by:LittleRedHat
ID: 7043418
None now :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now