Convert pointer to zlib stream to string?
-
I have a z_streamp, which is a pointer to a z_stream_s. z_stream_s is defined as follows:
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */Bytef \*next\_out; /\* next output byte should be put there \*/ uInt avail\_out; /\* remaining free space at next\_out \*/ uLong total\_out; /\* total nb of bytes output so far \*/ char \*msg; /\* last error message, NULL if no error \*/ struct internal\_state FAR \*state; /\* not visible by applications \*/ alloc\_func zalloc; /\* used to allocate the internal state \*/ free\_func zfree; /\* used to free the internal state \*/ voidpf opaque; /\* private data object passed to zalloc and zfree \*/ int data\_type; /\* best guess about the data type: binary or text \*/ uLong adler; /\* adler32 value of the uncompressed data \*/ uLong reserved; /\* reserved for future use \*/
} z_stream;
I am trying to convery the next_in Byte to a string but I get a c2059 error that doesn't make any sense (it complains about a parenthesis: error C2059: syntax error : ')') Here is my code:
z_stream_s zs;
zs = *z_stream_in;char dest(StackSizeOf(char));
strcpy(dest,zs.next_in*);(the *z_stream_in it uses is passed to it by the caller) I think I may be defining the char wrong but I don't think that's whats causing the error. Can anyone help please?
-
I have a z_streamp, which is a pointer to a z_stream_s. z_stream_s is defined as follows:
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */Bytef \*next\_out; /\* next output byte should be put there \*/ uInt avail\_out; /\* remaining free space at next\_out \*/ uLong total\_out; /\* total nb of bytes output so far \*/ char \*msg; /\* last error message, NULL if no error \*/ struct internal\_state FAR \*state; /\* not visible by applications \*/ alloc\_func zalloc; /\* used to allocate the internal state \*/ free\_func zfree; /\* used to free the internal state \*/ voidpf opaque; /\* private data object passed to zalloc and zfree \*/ int data\_type; /\* best guess about the data type: binary or text \*/ uLong adler; /\* adler32 value of the uncompressed data \*/ uLong reserved; /\* reserved for future use \*/
} z_stream;
I am trying to convery the next_in Byte to a string but I get a c2059 error that doesn't make any sense (it complains about a parenthesis: error C2059: syntax error : ')') Here is my code:
z_stream_s zs;
zs = *z_stream_in;char dest(StackSizeOf(char));
strcpy(dest,zs.next_in*);(the *z_stream_in it uses is passed to it by the caller) I think I may be defining the char wrong but I don't think that's whats causing the error. Can anyone help please?
I have few doubts 1. What is the type of z_stream_in? 2. Whether StackSizeOf class is defined by you? 3. In
strcpy(dest,zs.next_in*);
, Here what zs.next_in* means?Величие не Бога может быть недооценена.
-
I have few doubts 1. What is the type of z_stream_in? 2. Whether StackSizeOf class is defined by you? 3. In
strcpy(dest,zs.next_in*);
, Here what zs.next_in* means?Величие не Бога может быть недооценена.
-
1. z_streamp, which is means it is a pointer to a z_stream_s 2. StackSizeOf is defined as #define StackSizeOf(Type) ((sizeof(Type)<sizeof(PBYTE))?sizeof(PBYTE):(sizeof(Type))) 3. zs is a z_stream_s (see the definition of z_stream_s in my previous post)
strcpy takes parameter char* as first parameter and const char* as second parameter [^] so i hope Bytef is typedef of char. if so then explicit casting is not needed else needed and i think no need of zs.next_in* instead just zs.next_in is needed.
Величие не Бога может быть недооценена.
-
I have a z_streamp, which is a pointer to a z_stream_s. z_stream_s is defined as follows:
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */Bytef \*next\_out; /\* next output byte should be put there \*/ uInt avail\_out; /\* remaining free space at next\_out \*/ uLong total\_out; /\* total nb of bytes output so far \*/ char \*msg; /\* last error message, NULL if no error \*/ struct internal\_state FAR \*state; /\* not visible by applications \*/ alloc\_func zalloc; /\* used to allocate the internal state \*/ free\_func zfree; /\* used to free the internal state \*/ voidpf opaque; /\* private data object passed to zalloc and zfree \*/ int data\_type; /\* best guess about the data type: binary or text \*/ uLong adler; /\* adler32 value of the uncompressed data \*/ uLong reserved; /\* reserved for future use \*/
} z_stream;
I am trying to convery the next_in Byte to a string but I get a c2059 error that doesn't make any sense (it complains about a parenthesis: error C2059: syntax error : ')') Here is my code:
z_stream_s zs;
zs = *z_stream_in;char dest(StackSizeOf(char));
strcpy(dest,zs.next_in*);(the *z_stream_in it uses is passed to it by the caller) I think I may be defining the char wrong but I don't think that's whats causing the error. Can anyone help please?
Omnicoder wrote:
z_stream_s zs; zs = *z_stream_in; char dest(StackSizeOf(char)); strcpy(dest,zs.next_in*);
This code does not appear to make sense. I don't think you can set a z_stream_s to a reference as you are trying to do. Also
strcpy()
needs a pointer to an array for its source and destination fields. You have set the destination to a single character, and the source to an incomplete expresion.