Thread: Convert gsoap PHP program to C

  1. #16
    Registered User
    Join Date
    Oct 2013
    Location
    Midrand Gauteng South Africa
    Posts
    27
    Surely __sizestring will return the sizeof the related string rather than the size of the array?

  2. #17
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by straygrey View Post
    Surely __sizestring will return the sizeof the related string rather than the size of the array?
    No -- the end of the string is marked with a \0 character, so its length need not be stored. There is no similar thing for "I don't have any more strings", so the number of strings must be stored.

  3. #18
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    I'm pretty sure it gives the number of strings in the string array, not the length of any single string or the size in bytes. string is the name of the array of strings you are interested in. I bet if you changed that name of the string array to foo, you would have $int __sizefoo.

  4. #19
    Registered User
    Join Date
    Oct 2013
    Location
    Midrand Gauteng South Africa
    Posts
    27
    Sorry chaps but I still do not know what to fix to get my application to compile.
    this does not compile
    Code:
    dmmrp.c: In function ‘doUpdate’:
    dmmrp.c:90:63: error: ‘struct _ns1__GetMediaListResponse’ has no member named ‘GetMediaResult’
             result = sprintf(Message, "%s\n", GetMediaListResponse.GetMediaResult->string[i]);

    and if I use -> it also does not compile
    Code:
    dmmrp.c: In function ‘doUpdate’:
    dmmrp.c:90:63: error: invalid type argument of ‘->’ (have ‘struct _ns1__GetMediaListResponse’)
             result = sprintf(Message, "%s\n", GetMediaListResponse->GetMediaResult->string[i]);
                                                                  ^
    Last edited by straygrey; 10-31-2013 at 03:48 AM. Reason: Repeat previous to make message clearer

  5. #20
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by straygrey View Post
    Sorry chaps but I still do not know what to fix to get my application to compile.
    this does not compile
    Code:
    dmmrp.c: In function ‘doUpdate’:
    dmmrp.c:90:63: error: ‘struct _ns1__GetMediaListResponse’ has no member named ‘GetMediaResult’
             result = sprintf(Message, "%s\n", GetMediaListResponse.GetMediaResult->string[i]);
    Umm...read your code more carefully. Look back at post #14. Your struct does not have a member GetMediaResult...it's called something else.
    Quote Originally Posted by straygrey View Post
    and if I use -> it also does not compile
    Switching between . and -> and vice-versa is not a magic "fix-all" for struct member issues. The only difference is that you use . with a struct and -> with a pointer-to-struct, when you are accessing members. If you don't have a pointer-to-struct, switching to -> will not fix anything, only introduce another error. You must learn what a pointer is, and when something is and is not a pointer if you want to have any chance of doing this program.

  6. #21
    Registered User
    Join Date
    Oct 2013
    Location
    Midrand Gauteng South Africa
    Posts
    27
    Thank you and sorry to be a pain.

    It, of course, now compiles.
    Last edited by straygrey; 10-31-2013 at 08:54 AM. Reason: Next step in the process

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gsoap
    By banbino in forum C++ Programming
    Replies: 1
    Last Post: 12-02-2010, 09:55 AM
  2. Problem using GSOAP with OpenSSL on Linux
    By kuhn in forum C Programming
    Replies: 2
    Last Post: 05-19-2010, 05:14 PM
  3. Replies: 1
    Last Post: 03-16-2010, 10:17 AM
  4. Convert c++ program to c
    By tnt666 in forum C Programming
    Replies: 7
    Last Post: 12-01-2008, 09:23 AM
  5. Convert a C++ program?
    By unregistered in forum C Programming
    Replies: 4
    Last Post: 05-22-2002, 02:44 AM

Tags for this Thread