Phonecalls.

Posted by MahFreenAmeh on Sept. 11, 2007, 5:49 p.m.

Holy shit. I'm doing two blogs… in a row… over the course of two days? Well, that's pretty damn awesome. Anyways, I don't have much to say, as always, but I do have this as filler.

Earlier, during my off-period in computer science, instead of playing games or anything like that, I was working with C++, and I came up with a hexdumper out of my boredom. So I came home, and I rewrote it, with a few modifications, and then I rewrote it again into PERL. Now, assuming you want them, I'm going to post them both. If they don't run properly, I'm sorry. I can't error-check on this computer, because I can't take the time to install a compiler on it.

C++:

#include <fstream>
#include <iostream>

using namespace std;
int main(int argv, char* argc[]) {
	if(argv==1) {
	cout << "You forgot to put a filename.";
	cout << endl << "Usage: hexdump <filename>
";
	return 0;
	}
	else {
		istream f(argv[1]);
		if(!f.fail()) {
			int i = 0;
			int d = 0;
			while(!f.eof()) {
				if(i==16) {
					cout < "
" << hex << 16*d << ":	";
					i = 0;
					d++;
				}
				if(!f.eof()) {
					c = f.getc();
					cout << c << " ";
					i++;
					}
				}
			}
		}
	return 0;
	}

PERL:

if($ARGV[0] eq undef) {
die("Error: You forgot to put a filename.
 Usage: perl hexdump.pl <filename>
");
}
else {
print "
";
if(-f $ARGV[0]) {
local $/;
$f = open F,$ARGV[0];
$x = <F>;
$i = 0;
$d = 0;
print "	";
for($dd=0;$dd<=15;$dd++) {
printf("%2X ",$dd);
}
print "
";
for($dd=0;$dd<=56;$dd++) {
print "-";
}
foreach $g (split(//,$x)) {
if($i == 0) {
printf("
%06X: ",16*$d);
$i = 16;
$d++;
}
printf("%02X ",ord($g));
$i--;
}
print "
";
for($dd=0;$dd<=56;$dd++) {
print "-";
}

}
else { die "Sorry, that is not a file.";}
}

So that's about it for all that. I can't say that I have much more to say… Because most of it would just be me prattling on forever about someone that means ever so much to me.

The person who I'm waiting to call me. And notice: Replace /t, /n, with a backslash instead of a forwardslash.

Comments

JoshDreamland 17 years, 3 months ago

Burn in hell.

I wish so bad I could take a programming class here. They offer javascript. Woo.

WELCOME TO BUM FUCK OHIO:

POPULATION: 17.67354 (hardly anyone is all there.)

s 17 years, 3 months ago

I'm playing Ikachan,they're rambling of pearls…But that doesn't matter

You're code has STDs.I don't have STDs.Do you have STDs?

You should of been ruder with the mishap of filename error message

MahFreenAmeh 17 years, 3 months ago

Serprex, you should have seen it earlier. I considered sending a terminate signal to the main system and saying, "You messed up, therefore I shut you off!"

As per you, J@D, hey, I'm supposed to be the one pissed off at everyone else.

s 17 years, 3 months ago

NUHUH

Ima be pissed off at joo about being pissed off

I R TEH PIZD

Specially with those period ended Btitles

MahFreenAmeh 17 years, 3 months ago

I'll keep that in mind, Serprex.

But pizd is teh Offs?

s 17 years, 1 month ago

Where areth thou?