The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Creating files from the stringBuffer

Posted by aaronG on May 22, 2001 at 5:53 AM

Im working on a client server program where in the server sends the name of a file to the client into a string buffer which is then used to create the file name but when I try to do it it only uses the first letter as the file name rather than the whole name

Code im using:
else { // this is the client which receives characters
StringBuffer receiveString = new StringBuffer();
int receiveChar;
System.out.print ("Characters received:");

do {
receiveString.append((char)comms.read ());
String fName = receiveString.toString();
FileOutputStream fos = new FileOutputStream(fName);

Any help majorly appreciated



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us