HI, Jestem nowy w C# w ruchu z Java. Próbujesz odczytać plik za pomocą IO w HEX. Kiedy czytam pierwszy bajt, nie dostaję tego, co widzę w moim edytorze heksadecymalnym.Czytaj hex w C# za pomocą IO
Używam
StreamReader reader = new StreamReader(fileDirectory);
int hexIn;
String hex;
for (int i = 0; (hexIn = reader.Read()) != -1; i++){
hex = Convert.ToString(hexIn, 16);
}
w Javie użyłem ...
FileInputStream fis = new FileInputStream(file);
long length = file.length();
int hexIn;
String hex = "";
for(int i = 0; (hexIn = fis.read()) != -1; i++){
String s = Integer.toHexString(hexIn);
if(s.length() < 2){
s = "0" + Integer.toHexString(hexIn);
}
Mam nadzieję, że to ma sens. Każda pomoc będzie najbardziej apperciated :)
Dzięki
Co porównujesz do tego, czego się spodziewasz? –
Witam, dostaję FFFD nie D0CF, wydaje się, że FFFD, który jest odczytywany jest ascii z D0CF, coraz zmieszany teraz ha ha – Pete