Re: structs for data transfer?

From: John Harrison (john_andronicus_at_hotmail.com)
Date: 09/21/04


Date: Tue, 21 Sep 2004 06:57:38 +0100


"Phlip" <phlip_cpp@yahoo.com> wrote in message
news:qxB3d.21906$ZC7.12709@newssvr19.news.prodigy.com...
> John Harrison wrote:
>
>> Write some code to convert the struct you want to send into a char array.
>> Write some code to turn that char array back into a struct. Use the first
>> piece of code when you send, the second when you recieve. Trying to send
>> anything more complicated than char arrays between different types of
>> computers is asking for trouble.
>
> Oh, and then you must figure out either a length system for each part of
> the
> string, or sentinels and delimeters for the ends of strings. Then you must
> figure out how to escape the delimiters if your users type them inside
> strings. Then you might need a system to name each data element.
>
> Oh, and then you might localize, and need to pack UTF-8 into your strings.
>
> Use XML. If HTTP is slow, even to a server you programmed, then rewrite a
> simpler version of it.
>

Good advice but I got the impression that XML might be a bit beyond the OP.

john



Relevant Pages

  • Re: structs for data transfer?
    ... > Write some code to turn that char array back into a struct. ... or sentinels and delimeters for the ends of strings. ... figure out how to escape the delimiters if your users type them inside ...
    (comp.lang.cpp)
  • Re: Sanity check on call to imported DLL function
    ... Seems your struct declaration is wrong. ... The IntPtr DataPID should not be present ... "Default Marshaling for Strings", there is a subsection "Strings Used ... I'll try the char array ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Sanity check on call to imported DLL function
    ... "Default Marshaling for Strings", there is a subsection "Strings Used ... struct StringInfoT { ... public String f1; ... I'll try the char array ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Controlling Static Data and Memory Organization...If Possible...
    ... struct Stuff { ... const char * name; ... int main{ ... You will have to make the char array big enough for the ...
    (comp.lang.c)
  • Re: Lost in loops
    ... >> I am really stuck with my program that will compare two strings and ... >> assign scores between pairs of letters. ... >> is now in a 2D char array ...
    (comp.lang.java.programmer)