Click here to Skip to main content
15,891,951 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralByte swapping questions Pin
fuzzbuzz5-Dec-03 14:24
fuzzbuzz5-Dec-03 14:24 
GeneralRe: Byte swapping questions Pin
cmk5-Dec-03 19:41
cmk5-Dec-03 19:41 
Generaldoc/view question in MDI Pin
rkhuang5-Dec-03 14:06
rkhuang5-Dec-03 14:06 
GeneralRe: doc/view question in MDI Pin
kjessee5-Dec-03 15:11
kjessee5-Dec-03 15:11 
GeneralQuestion regarding Getting File Path Pin
Deepak Samuel5-Dec-03 13:56
Deepak Samuel5-Dec-03 13:56 
GeneralRe: Question regarding Getting File Path Pin
Jörgen Sigvardsson5-Dec-03 14:11
Jörgen Sigvardsson5-Dec-03 14:11 
GeneralChallenge to the geek in you! Pin
BaldwinMartin5-Dec-03 11:53
BaldwinMartin5-Dec-03 11:53 
GeneralVC error but not in gcc. Pin
Tili5-Dec-03 11:27
Tili5-Dec-03 11:27 
Hi.
I have been trying to compile a library.
It compiles fine under gcc compiler.
Here is the part of original code that doesnt compile.

struct iax_frame {<br />
	/* /Our/ call number */<br />
	unsigned short callno;<br />
	/* /Their/ call number */<br />
	unsigned short dcallno;<br />
	/* Start of raw frame (outgoing only) */<br />
	void *data;<br />
	/* Length of frame (outgoing only) */<br />
	int datalen;<br />
	/* How many retries so far? */<br />
	int retries;<br />
	/* Outgoing relative timestamp (ms) */<br />
	unsigned int ts;<br />
	/* How long to wait before retrying */<br />
	int retrytime;<br />
	/* Are we received out of order?  */<br />
	int outoforder;<br />
	/* Have we been sent at all yet? */<br />
	int sentyet;<br />
	/* Outgoing Packet sequence number */<br />
	int oseqno;<br />
	/* Next expected incoming packet sequence number */<br />
	int iseqno;<br />
	/* Non-zero if should be sent to transfer peer */<br />
	int transfer;<br />
	/* Non-zero if this is the final message */<br />
	int final;<br />
	/* Ingress or outgres */<br />
	int direction;<br />
	/* Retransmission ID */<br />
	int retrans;<br />
	/* Easy linking */<br />
	struct iax_frame *next;<br />
	struct iax_frame *prev;<br />
	/* Actual, isolated frame header */<br />
	struct ast_frame af;<br />
	unsigned char unused[AST_FRIENDLY_OFFSET];	<br />
	unsigned char afdata[0];	/* Data for frame */<br />
};<br />
<br />
// Notice the afdata[0];<br />
The code where i get error is <br />
<br />
       struct hell{				<br />
		struct iax_frame fr2;        		<br />
		unsigned char buffer[4096];   <br />
        } buf;<br />
<br />
//////////////////////////////////////////

The error is
error C2229: struct 'hell' has an illegal zero-sized array

If you are wondering why wouldnt i just put
unsigned char afdata[4096];
then the reason is that the sizeof will give me 4096 included in it and this will make it incompatible for sending over this protocol cuz i need to send iax_frame first and the data of variable length later.

This is a library and i cannot change the code inside it.

So do you ppl have any thoughts of allocating some memory infront of iax_frame so that i get afdata[0] to be 4096 at runtime.

doing it assembly way might be difficult too.
By the way it compiles fine if i put buffer before iax_frame in hell. THe software crashes.
Confused | :confused:



-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
GeneralRe: VC error but not in gcc. Pin
Jörgen Sigvardsson5-Dec-03 13:53
Jörgen Sigvardsson5-Dec-03 13:53 
GeneralRe: VC error but not in gcc. Pin
Michael Dunn5-Dec-03 17:39
sitebuilderMichael Dunn5-Dec-03 17:39 
GeneralError: Exception Breakpoint Pin
haritadala5-Dec-03 10:07
haritadala5-Dec-03 10:07 
Generalcommand-line arguments in VS7 Pin
karunswaroop5-Dec-03 8:27
karunswaroop5-Dec-03 8:27 
GeneralRe: command-line arguments in VS7 Pin
Michael P Butler5-Dec-03 8:42
Michael P Butler5-Dec-03 8:42 
GeneralRe: command-line arguments in VS7 Pin
karunswaroop5-Dec-03 9:33
karunswaroop5-Dec-03 9:33 
GeneralPrinting 2 Pages Per Sheet Pin
K. Shaffer5-Dec-03 7:58
K. Shaffer5-Dec-03 7:58 
GeneralRe: Printing 2 Pages Per Sheet Pin
Steve S9-Dec-03 0:59
Steve S9-Dec-03 0:59 
QuestionFILETIME? DosDateTimeToFileTime() ? Pin
Amit Dey5-Dec-03 7:48
Amit Dey5-Dec-03 7:48 
AnswerRe: FILETIME? DosDateTimeToFileTime() ? Pin
Michael Dunn5-Dec-03 17:46
sitebuilderMichael Dunn5-Dec-03 17:46 
GeneralRe: FILETIME? DosDateTimeToFileTime() ? Pin
Amit Dey5-Dec-03 22:06
Amit Dey5-Dec-03 22:06 
GeneralRe: FILETIME? DosDateTimeToFileTime() ? Pin
Michael Dunn6-Dec-03 0:33
sitebuilderMichael Dunn6-Dec-03 0:33 
GeneralTutorial Recommendations Pin
Roger Wright5-Dec-03 7:03
professionalRoger Wright5-Dec-03 7:03 
GeneralRe: Tutorial Recommendations Pin
Michael P Butler5-Dec-03 8:44
Michael P Butler5-Dec-03 8:44 
GeneralRe: Tutorial Recommendations Pin
Roger Wright5-Dec-03 9:03
professionalRoger Wright5-Dec-03 9:03 
GeneralRe: Tutorial Recommendations Pin
Michael P Butler5-Dec-03 9:15
Michael P Butler5-Dec-03 9:15 
GeneralRe: Tutorial Recommendations Pin
Roger Wright5-Dec-03 10:12
professionalRoger Wright5-Dec-03 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.