I want to know if this problem can be done easily in perl, and does anybody have any links or help to do it. I am having trouble trying to figure out how to read the file in. It can be of any type .txt, .gif .jpg, etc. Then how to work with that data. you cant open a .jpg or .gif to mess with the data, so I am stumped, I have no idea what to do. here is a more complete description of my problem.
I need to write a program that computes a CRC on an input file. The program should accept command-line arguments that give the input file name and an optional output file name.
If there are two filename arguments, then it should assume that the input file is a "normal" file without any CRC code attached to it. It should compute a CRC and append the computed remainder (the CRC code) to the end of the output file in the last two bytes. If there is one filename argument, then it should assume that the input file contains a computed CRC. Thus, it should perform a checking action by recomputing the CRC and determining whether the resulting remainder is zero. If there are two filename arguments, then the output file is essentially the same as the input file, except that it has the computed CRC appended to the end. If there is one filename argument, then the output is to the screen: the program reports whether an error was detected. All help is welcome=)
Edit by tye
In reply to crc-16 help
by PaulC
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.