- need help with parallel port comm program
- Posted by xexee1 on December 30th, 2003
hello group,
well leave the semantics, the full stops and commas. and a
happy new year to you all.
i have written a program in c++ to help pcs to communicate
over the parallel port. but its limitation is that it is limited to
characters only, and hence text files can only be sent over the link.
i somehow tried to use void buffers but to no use. will anybody
suggest anything.....
thank you for going through the posting.
bye and take CARE.ORG
- Posted by osmium on December 30th, 2003
xexee1 writes:
There are several methods (protocols) for sending binary data over a text
only link. yenc and MIME come to mind. Searching on those will likely lead
you to others.
- Posted by xexee1 on January 1st, 2004
"osmium" <r124c4u102@comcast.net> wrote in message news:<bssie5$vnsg$1@ID-179017.news.uni-berlin.de>...
hi osmium & board,
thanks for the help and thanks to anybody reading this posting or
for further suggestions. well osmium your hint just started me off in
a new direction after i got lost. upon your suggestion i found out
about yEnc but managed to doubt it as well.
the following is pseudo code for yEnc encoding from the site:
http://members.home.nl/lordsnow/yenc/yencoding.htm
all respect to the content keepers of the above site but i have a
silly doubt. what if i take 142 as the starting value. adding 42 will
make it 184, still within the extended ascii range. what according to
this implementation is the text range of characters? is it from
32[base10] to 126[base10] as i am thinking or something else?
A VERY HAPPY NEW YEAR board and bye and take CARE.ORG
// initialise //
CRITICAL_VALUES := CR, LF, NUL, =;
o := 1;
// step through input file //
FOR i := 1 TO END_OF_FILE
// read character and add the 42 offset //
temp := input[i];
temp := (temp + 42) MOD 256;
// check for critical value //
IF temp ISIN CRITICAL_VALUES THEN
// critical value, so send '=' to output, followed by value + 64 //
output[o] := '=';
o := o + 1;
output[o] := (temp + 64) MOD 256;
// not a critical value, so copy input to output //
ELSE output[o] := temp;
o := o + 1;
// repeat until finished //
NEXT i;
Note: the input is the original file. The output is the file encoded.
- Posted by xexee1 on January 1st, 2004
xexee1@yahoo.com (xexee1) wrote in message news:<76a0cf99.0312312347.78faa4ba@posting.google. com>...
Hello board,
welcome back after your new year parties.
given below is an encoding scheme i thought out to
convert binary files into pure text files, you know lying within
32[base 10] and 127[base 10]. if it encounters a value less than 128
it just checks to see that it is not less than 32 or equal to '=' or
'+', if it is then 32 is added to it and written to the output file.
when it encounters a value greater than or equal to 128 it subtracts
128 from it, now if it is less than 32 or is equal to '=' or '+' it
adds a further 32 to it and writes to the output file. it is simple
atleast as it looks and should work well and fine. it goes basically
like this :
(pseudo code) this may help if any doubt was there in the above
explanation
//////////////////////////ENCODING PROCESS\\\\\\\\\\\\\\\\\\\
begin
SET_OF_CONTROL_CHAR=[0,31]
input file is binary file
output file is encoded file
sizesource=sizeof(input file)
while(sizesource>0)
{
read a byte from input file
sizesource=sizesource-1
new_byte=byteMOD(128)
if(new_byte not equal to byte)
write '=' into output file
if(new_byte equal to '=' or ='+' or lies in
SET_OF_CONTROL_CHAR)
{
write '+' into output file
new_byte=new_byte+32
}
write new_byte into output file
}
end
///////////////////////////DECODING PROCESS\\\\\\\\\\\\\\\\\\
begin
input file is binary file
output file is encoded file
sizesource=sizeof(input file)
while(sizesource>0)
{
read byte from input file
sizesource=sizesource-1
new_byte=byte
if(new_byte equal to '+')
{
read new_byte from input file
sizesource=sizesource-1
new_byte=new_byte-32
}
if(new_byte equal to '=')
{
read new_byte from input file
sizesource=sizesource-1
if(new_byte equal to '+')
{
read new_byte from input file
sizesource=sizesource-1
new_byte=new_byte-32
}
new_byte=new_byte+128
}
write new_byte into output file
}
end
////////////////////////////////END\\\\\\\\\\\\\\\\\\\\\\\\\\\
but my agony is this that i am unable to implement the
above processes in c++. i can print out the code [which isn't
functioning well] if anybody wants to but it would be even better if
anybody came up with a solution of h** own. thanks for going through
my posting.
bye and take CARE.ORG
xexee
- Posted by xexee1 on January 2nd, 2004
xexee1@yahoo.com (xexee1) wrote in message news:<76a0cf99.0401010545.4c00c5fe@posting.google. com>...
hello board,
well this may seem a bit awkward if you look at the
previous two postings and considering the fact that i started the
thread and here i am with the solution by none other than me.
this posting is to inform that no further answers are
awaited and the question is over. in case anybody wants a solution to
the original question i have the implementation in c++ and the pseudo
code of course to clear things out. well thank you osmium
for the guidance but what i ended up with is something i created
myself and i like it.
xexee1