private static byte[] toCstr(String str) {
		int length = str.length();
		byte[] result = new byte[length + 1];
		for (int i = 0; i < length; i++) {
			result[i] = (byte) str.charAt(i);
		}
		result[length] = 0;
		return result;
	}