comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » SPAWN + readU + strings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: SPAWN + readU + strings [message #19857 is a reply to message #19728] Tue, 18 April 2000 00:00 Go to previous messageGo to previous message
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Ramji Digumarthi wrote:
>
> thanks to the reply from David Fanning about the reading the length of
> the string array.
> I forgot to mention that I do get the length of the string from the
> C-code, and I do read the string fine.
> the problem is on the next readu of variable...
> I get grabage.. IF the readU of the stirng commented out than
> the variable readU works fine .
>
> I am tryin to under stand what happens to readU with reading of the
> string??? I am also enclosing the both IDl and C-code...
>
>
> the C-code :::
> setbuf(stdout,(char *)0);
> strcpy(outStr,"Now opening the socket and waiting.\n");
> strOutlen=strlen(PoutStr);
> fprintf(stderr,"%i :: %d :: %s \r
> ",sizeof(strOutlen),strOutlen,outStr);
> write(1,&strOutlen,sizeof(int));
> write(1,outStr,sizeof(outStr));
>

Prepare to shoot me down if I'm wrong, but it looks to me as though
you are writing the wrong number of characters from the string
here. You don't tell us how you have declared outStr, but in C I
would think it is either a char pointer or a char array. The former
will have sizeof() = 4 (or 8 if a 64 bit system) and the latter will
be the length of the array regardless of what is in it.

Shouldn't you write strlen, or strOutlen bytes, which is the integer
you are writing before it as its length?


--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DLMs & IRIX
Next Topic: Visualization Development Environments 2000

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 02:31:18 PDT 2025

Total time taken to generate the page: 0.32047 seconds