You can use a DataOutputStream if the data you're trying to write is compatible with how it's going to be read on the C side. Check the documentation on writeFloat and writeChar carefully to see if that will actually work.
Otherwise you'll have to use a raw OutputStream
and encode the data into bytes yourself.
Edit: Just wanted to add - my best guess is that for your purposes, writeFloat
will work but writeChars
will not, due to encoding issues. Instead, you'll have to use the getBytes
method on your Java String
to get a byte array in whatever single-byte character encoding your C code is expecting, then write those bytes to the DataOutputStream
.