• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Ashamed to ask, but is there . . .

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

ricksimm

Member
Joined
Mar 9, 2003
Location
USA
a program that will show me the value of each byte in a text string- like CR is 13 and LF is 10 ? Thanks.
 
Hmm damn, I forgot how to attach files to a reply :S Anyways, if you have a C Compiler, you can compile the following C Program which I wrote some months back, and well basically even use it.

// Author: Mohammed Naif Amoodi
// Email: [email protected]
#include <stdio.h>
int main(int argc, char *argv[])
{
int counter,bytes_read;
unsigned long position = 0x0;
unsigned char buffer[16];
FILE *fp;

if(argc < 2)
{
fprintf(stderr,"USAGE: %s filename\n",(strrchr(argv[0],'\\')+1));
fprintf(stderr,"Type \"%s /?\" for more help",(strrchr(argv[0],'\\')+1));
return 1;
}

for(counter=1;counter<=argc;counter++)
{
if(!strcmp(argv[counter],"/?"))
{
printf("\n");
printf("ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸\n");
printf("³ -= Naif Dump v0.01 =- ³\n");
printf("³ Author: Mohammed Naif Amoodi ³\n");
printf("³ Email: [email protected] ³\n");
printf("ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;\n");

return 0;
}
}

if((fp = fopen(argv[1],"r+b"))==NULL)
{
fprintf(stderr,"ERROR opening file %s!",argv[1]);
return 1;
}

printf("FILE DUMP OF %s\n\n",argv[1]);
while(!feof(fp))
{
printf("%.10lX ",position);
bytes_read = fread(buffer,1,16,fp);
for(counter=0;counter<bytes_read;counter++)
{
printf("%.2X ",buffer[counter]);
}
if(bytes_read < 16);
{
counter = bytes_read;
while(counter < 16)
{
printf("%2c ", '.');
counter++;
}
}
printf(" ");
for(counter=0;counter<bytes_read;counter++)
{
if((buffer[counter] >= 33 && buffer[counter] <= 126))
printf("%c",buffer[counter]);
else
printf(".");
}
position = position + 0x10;
printf("\n");
}
fclose(fp);
}
 
Back