conversion: unsigned_char->file->unsigned_char ? 
Author Message
 conversion: unsigned_char->file->unsigned_char ?

Hi,

Assuming that one has a buffer of unsigned characters 'buffer', is the
following operation possible:

1. Put 'buffer' into a file.
2. Extract the same 'buffer' from the file.

In other words, can a file be a transparent medium for a string of unsigned
characters, so that one achieves 1-to-1 mapping between the input string and
output string?

The reason for asking is that I want to use files for conveying string of
unsigned characters from one host to another.

Best regards,
Marjan
--



Sun, 28 Aug 2005 00:10:09 GMT  
 conversion: unsigned_char->file->unsigned_char ?
in comp.lang.c.moderated i read:

Quote:
>Assuming that one has a buffer of unsigned characters 'buffer', is the
>following operation possible:

>1. Put 'buffer' into a file.
>2. Extract the same 'buffer' from the file.

please don't multi-post.  already answered in comp.lang.c.

--
bringing you boring signatures for 17 years
--



Sun, 28 Aug 2005 11:55:27 GMT  
 conversion: unsigned_char->file->unsigned_char ?

Quote:
> Hi,

> Assuming that one has a buffer of unsigned characters 'buffer', is the
> following operation possible:

> 1. Put 'buffer' into a file.
> 2. Extract the same 'buffer' from the file.

> In other words, can a file be a transparent medium for a string of
unsigned
> characters, so that one achieves 1-to-1 mapping between the input string
and
> output string?

> The reason for asking is that I want to use files for conveying string of
> unsigned characters from one host to another.

What you ask is sort of the point of file I/O.   There would be little value
in I/O if it wasn't possible for to read a file and get back a copy of what
was
originally written to it.

There are standard functions (eg in the standard header stdio.h) related
to opening, reading, writing, and closing files.

There obviously also needs to be a means of getting the files from the host
where they are written to the host where you want to read them.    There
are lots of solutions to that, not all of which are best described from the
point of view of programming in C.

Without more information on what you're trying to do, I'll hold back from
a discussion of other means of communicating information between
computers.
--



Sun, 28 Aug 2005 11:55:29 GMT  
 conversion: unsigned_char->file->unsigned_char ?

Quote:

> In other words, can a file be a transparent medium for a string of unsigned
> characters, so that one achieves 1-to-1 mapping between the input string and
> output string?
> The reason for asking is that I want to use files for conveying string of
> unsigned characters from one host to another.

You haven't adequately specified the problem.  There is no "magic"
way to transport textual information from a system that uses ASCII
encoding to or from one that uses EBCDIC, for example.  There does
exist an International Standard that includes code values that can
represent almost all characters in use anywhere in the world, but
it requires more than 16 bits per code value (31 bits in general).
There are some standard schemes for expressing those code values,
including UTF-8, which uses a variable number of octets, with the
7-bit ASCII codes represented by themselves, making it convenient
for adding support for international characters to existing ASCII-
oriented systems.  For maximum portability of encoded characters,
choose UTF-8 representation of the Unicode/ISO 10646 codeset.
Standard C includes support for handling such character encodings
via its wchar_t type, but it does not *require* that wchar_t use
the 10646 encoding.  Therefore, currently there is no truly
portable C code that can accomplish transparent character transport
via some intermediary (file).  However, if you're willing to limit
your code to platforms where characters encoded in type char have
only ASCII values, it is trivial to read and write them as UTF-8.
To avoid newline transliteration and end-of-record space t{*filter*}
that might occur for text streams (depending on the platform),
read and write the char arrays using binary streams.
--



Tue, 30 Aug 2005 00:00:04 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. conversion: unsigned_char->file->unsigned_char ?

2. File Format conversion, ascii freeform -->.csv <-->.wk1<-->dbf<-->?HELP

3. B>C>C++>VC++(MFC)>RAW API PROGRAMMING>ATL>COM>OLE>ADO>ASP.............

4. >>>>>>>>> What would you like in a debugger?

5. <<<<<<<Parsing help, please>>>>>>>>

6. Conversion Borland c++ ->>Visual c++!!

7. C->->->->C++

8. >>>> PUBLICATION QUALITY SOFTWARE MANUAL

9. Catching File->Open and File->Close

10. <<<>>>Need C code advice with functions and sorting.<<<>>>

11. >>>>>>Not enough C/UNIX people in NYC!

12. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

 

 
Powered by phpBB® Forum Software