On 26 Nov 2011 at 17:09, nierveze wrote:
hello every one,
is the a tool to make proms from *.bin output from compilers?
that is to say a program that divides the 16 bits into two slices of 8
bits to make proms?thanks best regards Alain Nierveze
nierveze at
radio-astronomie.com www.radio-astronomie.com
Here's a little MS-DOS C program that I wrote 24 years ago to do
this. If you'd rather hanve the .exe file, just email me.
--------------------------------------------------
#include <stdio.h>
#include <fcntl.h>
/*
Odd byte/Even byte splitting program.
Calling sequence is
oe o/e infile outfile
*/
main( argc, argv)
int argc;
char *argv[];
{
int ihand, ohand, oeflag;
char chb[2];
if (argc != 4)
{
fprintf( stderr, "Syntax is - oe o/e infile outfile\n");
exit(1);
}
switch ( *argv[1])
{ /* check out odd/even argument */
case 'E':
case 'e':
oeflag = 0; /* say even */
break;
case 'O':
case 'o':
oeflag = 1; /* say odd */
break;
default:
fprintf( stderr, "Flag must be \"odd\" or
\"even\"\n");
exit(1);
}
if ( ( ihand = open( argv[2], O_RDONLY+O_RAW)) < 0)
{
fprintf( stderr, "Unable to open %s\n", argv[2]);
exit(1);
}
if ( ( ohand = open( argv[3], O_CREAT+O_WRONLY+O_RAW)) < 0)
{
fprintf( stderr, "Could not create %s\n", argv[3]);
exit(1);
}
while ( read( ihand, chb, 2))
write( ohand, &chb[oeflag], 1);
close(ihand);
close(ohand);
exit(0);
} /* end of oe */
-----------------------------------------------------------------