R
RC
I have
BufferedReader bufferedReader =
new BufferedReader(new FileReader(inputfile_name));
int c;
while ((c = bufferedReader.read()) > -1 ) {
if (c > (int)128) {
System.err.println(
(char)c + " " +
c + " " +
Integer.toOctalString(c) + " " +
Integer.toHexString(c)
);
}
}
bufferedReader.close();
This is fine, I got print all characters which ASCII value greater than
128.
Now I do the same in C
if ((fp = fopen("inputfile_name", "r")) == NULL) {
fprintf(stderr, "Can't open %s\n", argv[1]);
exit(2);
}
int c;
while ((c = getc(fp)) != EOF) {
if (c > 128) {
printf("%c %d %o %x\n", c, c, c, c);
}
}
fclose(fp);
But in C I don't get print any character ASCII value greater than 128 by
read the same file.
I just wonder why, how do Java read those character ASCII greater
than 128?
BufferedReader bufferedReader =
new BufferedReader(new FileReader(inputfile_name));
int c;
while ((c = bufferedReader.read()) > -1 ) {
if (c > (int)128) {
System.err.println(
(char)c + " " +
c + " " +
Integer.toOctalString(c) + " " +
Integer.toHexString(c)
);
}
}
bufferedReader.close();
This is fine, I got print all characters which ASCII value greater than
128.
Now I do the same in C
if ((fp = fopen("inputfile_name", "r")) == NULL) {
fprintf(stderr, "Can't open %s\n", argv[1]);
exit(2);
}
int c;
while ((c = getc(fp)) != EOF) {
if (c > 128) {
printf("%c %d %o %x\n", c, c, c, c);
}
}
fclose(fp);
But in C I don't get print any character ASCII value greater than 128 by
read the same file.
I just wonder why, how do Java read those character ASCII greater
than 128?