|
Hi,
this is the recipe in pseudo-code:
1. follow a programming course
2. choose a programming language
3. get a development system
4. open the IDE
5. write some code that creates two processes
6. write some code that creates/writes to/reads from a 'Message queue'
7. run it
8. when problems occur, fix them
when stuck, read the documentation; use Google and/or MSDN.
when you have a specific question, ask it here, providing all relevant information and showing what
you did so far.
|
|
|
|
|
Hey man, he doesn't need all your points, he is 'Senior Developer', after all (I suppose... )
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
What happend? are you ill,your color is gray?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
how do I do step 1 - plz, its urgentz
chuckle - nice list Luc - I think it should be the stock-standard reply for these cases
hope you're having a fun weekend
Garth
|
|
|
|
|
Hi
do you give me an example??? because I don't do it .
thanks,
chet la het
|
|
|
|
|
I found this in the online help
http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx
Creating a Child Process with Redirected Input and Output
This may be what you are looking for. It is actually very clever and the example worked for me.
-------------
Bibo ergo sum
|
|
|
|
|
Have a look at the 'two processes message queue ' project in the 'gimme codez urgent ' section of the website www.cpallini.free.productz.com.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
... and if you don't trust that site, just search CodeProject. Most of the articles on CP
have been scrutinized by golden boys.
|
|
|
|
|
Luc Pattyn wrote: ... and if you don't trust that site
Are you communist?
-- Bob Roberts, 1992.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm not running for the senate.
|
|
|
|
|
I (Bob) am running for the Senate, you are the interviewer.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
What is the essence of your program?
Will it be ready in time? and within the budget limits?
What is your main problem?
(Please provide answers to each question in less than 14 seconds)
|
|
|
|
|
Sorry, time is up.
Capitol Hill will not be yours, try Porta Vittoria instead.
|
|
|
|
|
Oh, you communist looser... I (Bob) am actually not able to answer your questions, anyway I will win, 'cause I'm a true american patriot!
BTW Are you a terrorist?
BTW2: welcome in the THHB [^], Luc!
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have compiled the following program in MS Visual C++ 6.0
Its strange for me to know the output of the program.
#include <stdio.h>
struct struct1
{
int i;
};
struct struct2
{
char s[2];
};
struct struct3
{
char s[2];
int i;
};
struct struct4
{
char s1[2];
int i;
char s2[2];
};
struct struct5
{
int i;
char s2[2];
};
int main()
{
printf("\nSize of Structure 1 = %d",sizeof(struct struct1));
printf("\nSize of Structure 2 = %d",sizeof(struct struct2));
printf("\nSize of Structure 3 = %d",sizeof(struct struct3));
printf("\nSize of Structure 4 = %d",sizeof(struct struct4));
printf("\nSize of Structure 5 = %d",sizeof(struct struct5));
printf("\n\n");
return 0;
}
The size shown by the program for structure 1 and 2 is OK. But result of structure 3,4 and 5 is mind f***ing. Why; when I declare the integer and charector in the same structer, the compiler add 2 extra bytes?
Actually i am reading the data from a binary file using the structure. But this thing has made me fool from last 2
days.
If anyone knows the reason or solution of that problem, please reply.
----------------------Output of the program-----------------
Size of Structure 1 = 4
Size of Structure 2 = 2
Size of Structure 3 = 8
Size of Structure 4 = 12
Size of Structure 5 = 8
|
|
|
|
|
if I remember correctly, the compiler adds packing bytes in certain cases to align data properly in memory
I believe there's a #pragma (PACK,<something,possibly num packing bytes/alignment > ) statement/define that can be used to change this
that may give you enough info to google/search on to see how accurate my memory is at 11pm on a Sat night ....
'g'
|
|
|
|
|
The compiler want's to align data so that it can be accessed efficiently. This generally means aligning the data on an n-byte boundary (so the address of the data is a multiple of n), or whatever it takes because processor operations are optimised for reading aligned data. What this means in practise is that integers, floats and structures are on 4 or 8 byte boundaries.
When this is applied to data in a structure, it can mean that padding is inserted to ensure that items with alignment requirements (such as integers) are correctly aligned. This is what you are seeing.
For more information, here's a Wikipedia page on the subject[^].
|
|
|
|
|
Hi,
as the others said, there is some padding going on, i.e. the compiler skips a few byte positions by inserting NULL bytes, in order to get everything "naturally aligned", meaning a struct member with size n (n=1/2/4/8) should reside at an offset that is a multiple of n.
you typically don't have to worry about this, unless:
1. you need a lot of those structs, so memory usage becomes important
2. you have a union with another struct and expect things to overlap in a specific way
3. you are going to pass the struct to some other code (is basically same as 2)
4. you need to follow a certain data layout, maybe in a file or in a byte stream to/from a device
you can get a more compact struct by:
1. using a compiler switch or a pragma to tell the compiler not to perform natural alignment (not always
a good idea)
2. reordering your struct members, biggest first (not always acceptable) unless you happen to have
one whose size isn't a power of 2 (an array, another struct!), then biggest first but filling
the gaps yourself with the smaller ones.
BTW: structs themselves also get naturally aligned in memory; assume a struct with 14 useful bytes,
but due to its layout, it reports a size of 16; even when you manage to reorganize it so it shows
size=14, it will be located at an address that is a multiple of 16, so it will most probably effectively
occupy 16 bytes after all.
|
|
|
|
|
Thanks to All of you, for prompt response
|
|
|
|
|
I need a "Blum-Blum-Shub" PRNG implementation in plain C. Knows someone where I can find this stuff?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
I can't find
lip.h
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
Thanks! I found it!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Deal!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|