Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

What is the significance of the numbers 32 and 32808? I don't think they are doing what you expect them to be doing.

I suspect you want to read 32 bytes starting at 32808 bytes into the CD. What you are asking read to do is read the first 32 bytes from the cdrom and place them into $lable starting at a 32808 byte offset. This will put 32808 nul characters into $lable followed by the first 32 bytes from the cdrom.

To do what I think you are trying to do, you need to first seek to the right offset, then read 32 bytes. Try this.

open CD,"<","/dev/cdrom" or die "Unable to open CDROM: $!"; seek CD,32808,0 or die "Unable to seek: $!"; read CD,$lable,32 or die "Unable to read from CD: $!"; close CD; print $lable,$/;

I tried this with a data disc on my system and it displayed Debian 3.0 r0 i386 Bin-1        1.

90% of every Perl application is already written.
dragonchild

In reply to Re: How do I read a CD volume label? by pfaut
in thread How do I read a CD volume label? by joggi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-24 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found