|
dear all
this is main function:
double a [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
for (int number = 1; number <= 10; number ++)
{
cout << setw(4) << number << endl;
printArray(a);
}
number ++;
void printArray ( double a [3][4])
{
for ( int i =0; i< 3; i++)
{
for (int j = 0; j < 4; j++)
cout <<setw(10) << setprecision(6) << setiosflags(ios::fixed|ios::showpoint) << a[i][j] << setw(10) ;
cout << endl;
}
}
how can i get 10 3x4 matrix and the each value inside array a is random real number....thanks a lot.
Li Zhiyuan
4/01/2008
|
|
|
|
|
I read that answer and yes, I saw before that tutorial but it really could not help too much
I just want an opinion of someone who made a project with XPCOM components before and know how to start things up. Is there anybody....?
Thanks again
|
|
|
|
|
What in all creation is XPCOM?
Do you mean COM on Windows XP or is this some obscure and badly named technology that no one actually uses?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
It's nothing obscure or old. View this:
http://www.mozilla.org/projects/xpcom/book/cxc/html/quicktour2.html#1003424
or this
http://www.iosart.com/firefox/xpcom/
|
|
|
|
|
Fine but you seem to have answered your own question. The instructions for constructing an XPCOM Dll in MSVC++ are here[^] on the page you posted a link to. What is it that you can't do?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I did that project too and succeeded after 2 days to build it without errors and when testing the component on firefox it gives a bunch of errors
That's why I SAID that I need the help of someone who DID THIS BEFORE !!!
Thanks
|
|
|
|
|
That's fine, no need to shout, there clearly aren't a lot of XPCOM guru's here so I suggest you either post the specific errors and ask a specific question (It all looks like pretty standard C++ stuff so you might get some help) or look for a dedicated XPCOM developer community elsewhere. If there isn't one out there then my original comment about obscurity stands.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
cuesdean florin wrote: That's why I SAID that I need the help of someone who DID THIS BEFORE !!!
Just so you know, I voted you a one because you're RETARDED.
|
|
|
|
|
You should have posted the error codes / descriptions ...
Maxwell Chen
|
|
|
|
|
Hi all,
Look at the following lines.
char *tempBuff[1024];
unsigned int iReq;
I want to copy the tempBuff to another buffer, adding the iReq to in-front of the tempBuff. How it is possible.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Are you sure your buffer should contain 1024 char pointers?
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 it should be char tempBuff[1024]
I appreciate your help all the time...
Eranga
|
|
|
|
|
char tempBuff[1024];
unsigned int iReq;
char newBuff[1024 + sizeof(iReq)];
memcpy(newBuff, &iReq, sizeof(iReq));
memcpy(newBuff + sizeof(iReq), tempBuff, 1024);
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]
|
|
|
|
|
TO CPallini:
Then how to read the first four bytes out to form the int value?
<br />
char tempBuff[1024];<br />
unsigned int iReq;
char newBuff[1024 + sizeof(iReq)];<br />
memcpy(newBuff, &iReq, sizeof(iReq));<br />
memcpy(newBuff + sizeof(iReq), tempBuff, 1024);
Can this achieve?
<br />
int *iptr = &newBuff[0];<br />
int iTReq = *iptr;
|
|
|
|
|
fantasy1215 wrote: Can this achieve?
int *iptr = &newBuff[0];
int iTReq = *iptr;
Yes.
Maxwell Chen
|
|
|
|
|
The code is correct, provided you cast the pointer, i.e.
int *iptr = (int*) (&newBuff[0]);
int iTReq = *iptr;
you can also do directly
int iTReq = *((int*)(&newBuff[0]);
or
int iTReq = *((int*)newBuff);
Cheers
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]
|
|
|
|
|
Hello friends,
I want to delete shortcuts that is .lnk files from a particular folder.
some buddy please suggest & give some Sample code for this.
Thanks in advance...
|
|
|
|
|
|
You can delete them just like you would any other file. What extension the file has is unimportant.
"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
|
|
|
|
|
Hi
In my system not installed languagepack.when i paste chinese characters in rtf ..
In sending i wrote this code...
here m_chattext is rtf object.
m_chattext.GetWindowText(m_Text);
AfxMessageBox(m_Text);
in messagebox the chinese characters are not displaying..its coming ???? how i can solve this problem ...plz tell...
#sanroop#
|
|
|
|
|
do you have compiled your project as unicode ?
if not, make sure that you use
preprocessor definitions ( c++ page )
_UNICODE
output (link page) - entry point symbol
wWinMainCRTStartup
further on you could use _T("") instead "" in your code
hope it helps
|
|
|
|
|
no sir its not coming....
#sanroop#
|
|
|
|
|
i think you are correct
perhaps you could use CEdit instead but if not keep in mind
RichEditCtrl in Visual C++ 7.0 supports Unicode. To obtain Unicode strings from the RichEditCtrl box, use EM_GETTEXTEX message instead of GetDlgItemText.
SendMessage(
EM_GETTEXTEX,
(LPARAM) &getTextEx, // GETTEXTEX structure
(WPARAM) lpszWChar // output WCHAR array
);
see also:
http://easai.00freehost.com/unicode.html[^]
|
|
|
|
|
Hi friends,
I am trying to allocate around 3 sets of nearly 1.8MB of memory with calloc inside OnInitDialog() function of MFC. I used a memory leak detector tool and before I could start the worker threads I was able to see memory leaks in the lines which I used to allocate the memory mentioned above. Is there any issue in using calloc for memory allocation more than 64KB. I am using Win2000 with Visual studio 6.0 (VC++).
Following is the code snippet I used.
char *source_buf;
unsigned long size = 9001;
source_buf = (char*) calloc((size*200),sizeof(char));
|
|
|
|
|
Does your application check calloc return value?
Does it free allocated memory?
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]
|
|
|
|