theory of the netwoprk chat
ok. so me and a c++ writer are thinking of making a network chat server using both c++ and java. I create 1 client for java and he does a c++ and they both read and write to a single text document in a location. so my thing is can we write a file to a location other than just where the .jar file(i use jar to execute my client) ."Before you say dont bother or why" We want to do this just for the joy of doing it. And to test our individual I/O sections of our librarys.
Re: theory of the netwoprk chat
Quote:
can we write a file to a location other than just where the .jar file
Yes, you can write to any allowed location on the PC with a java program running from a jar file.
Re: theory of the netwoprk chat
ok sorry been inactive for a bit.
I even figured out how to write to a different location. Now there is 2 things i would like to know but only 1 on this thread. In buffered write how do you get it to read from a file. then add to the file while keeping what is already written? can someone give me a api or documentation that would help because i cant find anythi
Re: theory of the netwoprk chat
Quote:
. In buffered write how do you get it to read from a file.
you don't read with a bufferwriter.
Quote:
add to the file while keeping what is already
One of the file writing classes has a constructor that has an extra boolean parameter the specifies if the file should be appended to instead of overwritten. Check the API doc for how to code it.
http://download.oracle.com/docs/cd/E...se/6/docs/api/
Re: theory of the netwoprk chat
Appreciate i been looking and couldnt find a doc for it.
Re: theory of the netwoprk chat
Quote:
couldnt find a doc for it.
What is the "it"?
What are the classes you are using?
Re: theory of the netwoprk chat
oh i just started looking through the api doc and all i found was a append char not a string. and Im working on appending entire strings to the .txt,.dat.or. file im using. and that was a generic it. i meant i had been looking for a api doc that could help and havent found the right 1 yet.
Re: theory of the netwoprk chat
What are the classes you are using?
There is a file writing class with append mode.
Re: theory of the netwoprk chat
I/O class. (All i know for sure is i have to throw a IOException in any section of the class that uses my buffered writer and readers) (2 seperate methods)
Re: theory of the netwoprk chat
Quote:
i have to throw a IOException
Why is that?
Do you mean you need to write code to catch an exception or to pass the handling of the exception to a higher level?
Re: theory of the netwoprk chat
Im not really sure y i have to the the exception. I was just taught to do that with a bufferedf writer. I will google it and see if im just doing bad programming (highly probable ) Yes i do take better care of my spelling during programming.