|
DavidCrow wrote: Computers do what they're told, no more, no less
You are a dreamer, my friend.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: You are a dreamer, my friend.
How so?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Computers do anything but what you've told to do.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: Computers do anything but what you've told to do.
yeah .... i agree.... !
|
|
|
|
|
Hard of hearing; practically deaf in some cases!
|
|
|
|
|
Usually, if we want to connect two clients,we have to create a server,which
will act as a bridge between the two clients,but the server must be in a WAN. Now, I want to ask ,could we create a server in a LAN?
|
|
|
|
|
A server can be in a LAN - but then it may as well not exist, and you could just connect the two clients together and do peer to peer.
Assuming both LANs have firewalls on them, then you need some sort of 3rd party they can both connect to - which I'm guessing is why you have the server in the first place.
Iain.
|
|
|
|
|
Thank you,Iain. You know if we want to connect to a computer B in another LAN, we have to go through the "gateway" (firewalls,you refer to)of the LAN. But if B has not heard the message that we want to connect with it, B will not do "Hole Punching" for this connection, so the connection will be failed.
A server C in a WAN is the resolution, if we want to connect A and B which are in different LANs, so first,A tells C:"I want to connect with B",At the same time B tells C:"If someone wants to talk with me,please let me know".C
tells B:"A in another LAN want to talk with you",now,B will do one thing that is called "Hole Punching",if B finishes this,the connection between A and B is success.
But C must be in a WAN,can we find a server in a LAN(A or B in this LAN is best)to replace C ?
|
|
|
|
|
pengpcz wrote: Usually, if we want to connect two clients,we have to create a server...
Only if there is something on that server that one of them needs (e.g., IM server). Otherwise, they can connect directly.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This is the piece of code for which i am getting runtime error
void read_all_pns_files( void )
{
FILE *fp1, *fp2;
char pns_name[12];
short int n, ret;
A320_atp atp_a320;
A330_atp atp_a330;
B320_atp atp_b320;
B330_atp atp_b330;
D320_atp atp_d320;
D330_atp atp_d330;
F340_atp atp_f340;
I320_ATP atp_i320;
I330_ATP atp_i330;
P320_ATP atp_p320;
P330_ATP atp_p330;
struct {
char PARTNUMMER[40];
char AMENDMENT[2];
char MEN_FILE[13];
short int GERAET;
}part;
memset(pns_name,'\0',12);
memset(part.PARTNUMMER,'\0',40);
memset(part.AMENDMENT,'\0',2);
memset(part.MEN_FILE,'\0',13);
if((fp1=fopen("ALL_PNS.DAT", "wb")) != NULL)
{
for(n=0; n<11; n++)
{
sprintf(pns_name, "%s.PNS", check_name[n]);
sprintf(part.MEN_FILE, "%s.MEN", check_name[n]);
if((fp2=fopen(pns_name, "rb")) != NULL)
{
while(!feof(fp2))
{
switch(n)
{
case 0:
ret=fread(&atp_a320, sizeof(atp_a320), 1, fp2);
strcpy(part.PARTNUMMER, atp_a320.PARTNUMMER);
strcpy(part.AMENDMENT, atp_a320.AMENDMENT);
break;
case 1:
ret=fread(&atp_a330, sizeof(A330_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_a330.PARTNUMMER);
strcpy(part.AMENDMENT, atp_a330.AMENDMENT);
break;
case 2:
ret=fread(&atp_b320, sizeof(B320_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_b320.PARTNUMMER);
strcpy(part.AMENDMENT, atp_b320.AMENDMENT);
break;
case 3:
ret=fread(&atp_b330, sizeof(B330_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_b330.PARTNUMMER);
strcpy(part.AMENDMENT, atp_b330.AMENDMENT);
break;
case 4:
ret=fread(&atp_d320, sizeof(D320_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_d320.PARTNUMMER);
strcpy(part.AMENDMENT, atp_d320.AMENDMENT);
break;
case 5:
ret=fread(&atp_d330, sizeof(D330_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_d330.PARTNUMMER);
strcpy(part.AMENDMENT, atp_d330.AMENDMENT);
break;
case 6:
ret=fread(&atp_f340, sizeof(F340_atp), 1, fp2);
strcpy(part.PARTNUMMER,atp_f340.PARTNUMMER);
strcpy(part.AMENDMENT, atp_f340.AMENDMENT);
break;
case 7:
ret=fread(&atp_i320, sizeof(I320_ATP), 1, fp2);
strcpy(part.PARTNUMMER,atp_i320.PARTNUMMER);
strcpy(part.AMENDMENT, atp_i320.Amendment);
break;
case 8:
ret=fread(&atp_i330, sizeof(I330_ATP), 1, fp2);
strcpy(part.PARTNUMMER,atp_i330.PARTNUMMER);
strcpy(part.AMENDMENT, atp_i330.Amendment);
break;
case 9:
ret=fread(&atp_p320, sizeof(P320_ATP), 1, fp2);
strcpy(part.PARTNUMMER,atp_p320.PARTNUMMER);
strcpy(part.AMENDMENT, atp_p320.AMENDMENT);
break;
case 10:
ret=fread(&atp_p330, sizeof(P330_ATP), 1, fp2);
strcpy(part.PARTNUMMER,atp_p330.PARTNUMMER);
strcpy(part.AMENDMENT, atp_p330.AMENDMENT);
break;
default:
break;
}
part.GERAET = n;
if(ret==1) fwrite(&part, sizeof(part), 1, fp1);
}
}
if(fp2)
fclose(fp2);
}
if(fp1)
fclose(fp1);
}
}
I am getting run-time CHECK FAILURE #2 stack around the variable 'part' was corrupted.
Thanks for your help
|
|
|
|
|
Where does check_name[] come from? How is initialized?
BTW enclose code in <pre> tags, for instance
<pre>
</pre>
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
static char check_name[12][5] = {
"A320", "A330", "B320", "B330", "D320",
"D330", "F340", "I320", "I330", "P320", "P330" };
this is how check_name is initialized.
|
|
|
|
|
OK, it looks fine. Now, could you please reformat OP code using <pre> tags?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Friday, January 18, 2008 5:10:20 AM
|
|
|
|
|
what do you mena by OP code
|
|
|
|
|
The (long) code snippet of the original post.
You may also repost it, correctly formatted, of course.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Have you used the debugger to single-step through the code to find the offending statement(s)?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Comment #1: Try to remove "magic numbers" in the code.
Comment #2: check_name is intialized with how many values?
What happens in the following code if, by some chance, check_name[n] is a character string longer than 11?
char check_name[12][5];
char pns_name[12];
sprintf(pns_name, "%s.PNS", check_name[n]);
Comment #3: Walk through code in the debugger. Use small numbers.
|
|
|
|
|
I am drawing a bitmap on dc using loadImage() and bitblt method
it is working fine. but my problem is that I cannot change the alpha
values of the image i.e. from 0 - 255
Trioum
|
|
|
|
|
AlphaBlend () API can be used.
Come online at:-
jubinc@skype
|
|
|
|
|
but it works with 32bit bitmap I am working with 24 bit.
Trioum
|
|
|
|
|
AFAIK 24 bit bitmaps have not an alpha channel, Am I wrong?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Sorry for quering .I am reviewing my question again actually
I want to set the transparency of the bitmap i.e. from (0-255).
Trioum
|
|
|
|
|
How are you displaying your bitmap ? And what do you need to do exactly ? Do you only need to have some parts of your bitmap transparent ? If yes, take a look at TransparentBlt[^]
|
|
|
|
|
No transparent blt transparent some part. I want the whole image
Trioum
|
|
|
|
|
Why you can't use 32-bit ones?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|