codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Conversion  RREMEDIO at 17:50 on Friday, October 14, 2005
 

Given : DataOutputStream dos

Condition : when passing the following string C3B307EC48ED80AA into dos.writeBytes, the string is changed to C3B307EC48EDACAA

Does anyone no why ?


  Re: Conversion  crwood at 21:31 on Sunday, October 16, 2005
 

I couldn't get this to misbehave. See how it does for you.

import java.io.*;

public class DataWriteTest
{
public static void main(String[] args)
{
String s = "C3B307EC48ED80AA";
String filePath = "/forum/dataWriteTest.txt";
System.out.println("write to file: " + s);
writeString(s, filePath);
System.out.println("read from file: " + readString(filePath));
}

private static void writeString(String s, String destPath)
{
DataOutputStream dos = null;
try
{
dos = new DataOutputStream(
new FileOutputStream(destPath));
dos.writeBytes(s);
dos.close();
}
catch(IOException ioe)
{
System.out.println("write: " + ioe.getMessage());
}
}

private static String readString(String filePath)
{
StringBuilder sb = new StringBuilder(); // j2se 1.4+
// or you can use the legacy StringBuffer
//StringBuffer sb = new StringBuffer();
BufferedReader br = null;
try
{
br = new BufferedReader(
new InputStreamReader(
new FileInputStream(filePath)));
String line;
while((line = br.readLine()) != null)
sb.append(line + "\n");
br.close();
}
catch(IOException ioe)
{
System.out.println("read: " + ioe.getMessage());
}
return sb.toString();
}
}


  Re: Conversion  blade250 at 15:02 on Saturday, April 29, 2006
 

on a bit of a side note, how do i convert one thing from another using a user defined number?

I've created 3 Textboxes, 2 so the user can input wat there converting, eg £ to euros then another one to say how many euros r in a pound.

Like the user types in theres 3 euros in a pound in one box. so thats the exchange box.

the user then wants to know how many euros are in a pound, so in the pound text box puts 50, i then want java to look for what the user defined exchange rate was then input the text in the euro field and vice versa. if no exchange is applied then there should be a default of for example 1.

do i have to declare them on the Jframe form? like
int Euro
int pound
int euroPerPound
int Pound per Euro


<Added>

Wrong Forum, Sorry, if anoyone knows tho please help lol








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  How to send multiple perameters in SOAP request.
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007