hi all i have a problem while creatting a file. the file is .bin file which should have the byte 0x80 the decimal value is 128 the char is E euro symbol i have a Integer value which is 128 i read from serial port while writting i am giving write(128); but the char which is taking is '?' and hex value is 3f and the Dec value is 63.
Can you show us some code that produces the wrong result? That might make it easier to help you.
Where do you see it displayed as a '?' (question mark)?
Note that you have to take the character encoding into account. The code 128 is the Euro sign in Windows codepage 1252, but not in most other standard character encodings such as UTF-8 or ISO-8859-1. If the software you are using to display the character doesn't use cp-1252, then you will not see an Euro sign if you send it character code 128.
So you really don't specify the character encoding. For all files that contain anything but US-ASCII you should always specify the encoding. Plus, in Java it's customary to use Unicode, so you should write the "\\u20AC" character, in which case Java will write whatever is appropriate for the given encoding.
If you need files that can be used cross-platforms, these days it's best to use the UTF-8 encoding; just remember to specify that both for reading and for writing.
Ping & DNS - updated with new look and Ping home screen widget