Re: How to display binary file contents if it is stored in an integer array?



loudking wrote:

Well, what I actually mean is that the client is going to upload a
file to the server and the server will store the file content in the
memory. Later, the client will fetch the file from the server and
display it in stdout.

So the test script will be

./client add server test.pdf
./client fetch server > test_2.pdf
diff test.pdf test_2.pdf

So in my case, neither printf("%c") nor printf("%d") will work ...

You keep saying that, but you don't say why you think it's true.

int i;
for (i=0; i < integer_array_len; i++)
printf("%c", integer_array_val[i]);

Did you read Chris-Dollin-at-HP's reply? Because he points out that
if you write the wrong thing out, you'll get the wrong answer.

Try a simple test case first, for heavens sake. Make sure you can
write out zero bytes, one byte, two, three, four; five bytes, six
bytes, seven bytes, eight. At the moment your problem is nothing to
do with client-server communication: it's about rendering data to
the output.

Try some data like:

unsigned char someData[] =
{ 1, 2, 0, 17, 127, 128, 254, 255, 31, 32 };

and write it out with loops like:

for (i = 0; i < sizeof (someData); i += 1)
writeOutMyData( &someData[0], &someData[i] );

--
Signed And Sealed Hedgehog
Meaning precedes definition.

.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)
  • Re: What doesnt lend itself to OO?
    ... > rather than client code. ... no way to do that without also touching the object with clock semantics ... will not encapsulate both clock semantics and network semantics. ... The server can do whatever it wants ...
    (comp.object)
  • RE: Fax monitor incoming + outgoing calls?
    ... problem between the client computer and the SBS server. ... Client is using the internal IP address of the SBS server as the ... To the folder redirection GPO issue: ...
    (microsoft.public.windows.server.sbs)