D
Daniel Berger
Hi all,
According to the MSDN docs, the _isatty() function will return true
for any character device (terminal, console, printer, or serial port).
Thus, this works as expected:
File.new("NUL").isatty # true
But this doesn't:
File.chardev?("NUL") # false
I've provided some sample C code below. I can add this into
win32-file, but I'd like to see it corrected in core Ruby.
Also, does anyone know how to detect a block device on Win32?
Regards,
Dan
/* chardev test */
#include <stdio.h>
#include <io.h>
int main(){
FILE *fd;
// Also works with "aux", etc
if( (fd = fopen("NUL","r")) == NULL){
printf("Failed!\n");
return -1;
}
if(_isatty(_fileno(fd))){
printf("Char device!\n"); // True
}
fclose(fd);
printf("done\n");
return 0;
}
According to the MSDN docs, the _isatty() function will return true
for any character device (terminal, console, printer, or serial port).
Thus, this works as expected:
File.new("NUL").isatty # true
But this doesn't:
File.chardev?("NUL") # false
I've provided some sample C code below. I can add this into
win32-file, but I'd like to see it corrected in core Ruby.
Also, does anyone know how to detect a block device on Win32?
Regards,
Dan
/* chardev test */
#include <stdio.h>
#include <io.h>
int main(){
FILE *fd;
// Also works with "aux", etc
if( (fd = fopen("NUL","r")) == NULL){
printf("Failed!\n");
return -1;
}
if(_isatty(_fileno(fd))){
printf("Char device!\n"); // True
}
fclose(fd);
printf("done\n");
return 0;
}