Thread open() liefert "Inappropriate ioctl for device" (8 answers)
Opened by toby at 2010-10-26 17:37

pq
 2010-10-26 17:40
#142195 #142195
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
perldoc perlvar:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
       $OS_ERROR
$ERRNO
$! If used numerically, yields the current value of the C "errno" variable, or
in other words, if a system or library call fails, it sets this variable.
This means that the value of $! is meaningful only immediately after a
failure:

if (open(FH, $filename)) {
# Here $! is meaningless.
...
} else {
# ONLY here is $! meaningful.
...
# Already here $! might be meaningless.
}
# Since here we might have either success or failure,
# here $! is meaningless.


du musst den erfolg des open prüfen, nicht ob in $! was drinsteht. das geht klassischerweise mit
open my $fh, "<", "file" or die $!;

wenn das open glückt, dann kann im prinzip alles in $! stehen, aber dann sollte man es auch nicht abfragen.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread open() liefert "Inappropriate ioctl for device"