|
if you need to copy the whole 3x4 array you can use one of the following approaches:
(1) use an iteration over all the array elements, i.e. change from
gbest[i][3][4]=a[i][3][4];
(BTW, the above code is wrong, you're accessing elements out of the array boundaries)
to
for (j=0; j<3; j++)
for (k=0; k<4; k++)
gbest[i][j][k]=a[i][j][k];
(2) do a crude copy of memory, i.e. change
gbest[i][3][4]=a[i][3][4];
to
memcpy(&gbest[i], &a[i], 3*4*sizeof(a[0][0][0]));
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]
|
|
|
|
|
thanks friend, i solved problem, by the way, how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Please elaborate, I don't understand.
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]
|
|
|
|
|
hi am using vc++ mfc and pocket pc6.0.
i has 2 file in a same name.
1.windows\paul
2.temp\paul
i was used a code shellexecuteex to open files.
but it defaultly open windows\paul file.
to change the folder, what is the procedure?
can anybody help me?
paulraj
|
|
|
|
|
You can use this way.
#include <fstream>
std::fstream fw("C:\\WINDOWS\\paul", std::ios::in);
std::fstream ft("C:\\temp\\paul", std::ios::in | std::ios::out | std::ios::app);
Maxwell Chen
|
|
|
|
|
gnanapaul wrote: to change the folder, what is the procedure?
SetWorkingDirectory() , but changing folders is not necessary just to open a file.
"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
|
|
|
|
|
Sorry, the two previous answers are not relevant.
Windows CE knows nothing about a current directory or a path environment variable.
Always provide a Unicode full path beginning at the root like L"\\windows\\paul\\filename.ext" .
cheers,
AR
|
|
|
|
|
Hi,
I want to login a website eg aaa.com
so I do this,
I use SendRequest send my username an password
pFile->AddRequestHeaders("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*");
pFile->AddRequestHeaders("Referer: http://www.boofdollars.com/index.php?view=login&");
pFile->AddRequestHeaders("Accept-Language: zh-cn");
pFile->AddRequestHeaders("Content-Type: application/x-www-form-urlencoded");
pFile->AddRequestHeaders("Accept-Encoding: gzip, deflate");
pFile->AddRequestHeaders("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 2.0.50727)");
pFile->AddRequestHeaders("Host: www.boofdollars.com");
pFile->AddRequestHeaders("Content-Length: 80");
pFile->AddRequestHeaders("Connection: Keep-Alive");
pFile->AddRequestHeaders("Cache-Control: no-cache");
pFile->AddRequestHeaders("Cookie: "+cookie_);
pFile->AddRequestHeaders("returnTo=&id=&ac=stats&step=&ptype=&form_user=goodhere&form_pwd=goodhere");
pFile->SendRequest(NULL,0,lpOptional,strlen(lpOptional));//80 bytes skipped. Reason: The content type is not captured.
Why?
I must creat a cookie?
Thank you
|
|
|
|
|
What is the problem you are having?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
Is there any API/”MFC’s class method” to check if a particular database provider (Oracle, SQL etc.) is installed or not?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
What about trying to connect?
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]
|
|
|
|
|
Does this help?
"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 All,
If I run the Activex Control Test Container Application to test the activex control, the Test Container application either crashes or dumps an "unspeifified error" as "Microsoft Development Environment has encounters a problem and need to close".
Help me to fix the error!
|
|
|
|
|
hi
i have a application in windows mobile that is to create a ini file.
in nthe same ini file i must write data and read the data
k.guru moorthy
|
|
|
|
|
|
// select suitable seedwave file for the deck
CString file_now;
s_dis=0;
int ii=0;
file_now=ftitle[0];
s_dis=sd_dis[0];
//
do {
file_now=ftitle[ii];
s_dis=sd_dis[ii];
//
ii =ii+1;
//
} while (ii<nfile && sd_dis[ii]<dis);
//
I debudg my program I got "Access Violation" at ii=ii+1; all other variables print value correctly. I really do not know what is the problem ?
Thanks for the help
|
|
|
|
|
mrby123 wrote: I debudg my program I got "Access Violation" at ii=ii+1;
What is the value of ii at this point?
"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
|
|
|
|
|
at this point ii=0. However, if the statement would exicute, ii should be 1.
However, access violation occured when the statement was tried to exicute.
You can see I initialized ii before the block.
Thanks
modified on Saturday, January 26, 2008 2:54:41 AM
|
|
|
|
|
I think you should post also array declarations.
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]
|
|
|
|
|
Thanks for your response.
Here is the array declarations:
float sd_dis[20];
CString ftitle[20];
//
CString file_now;
s_dis=0;
int ii;
ii=0;
do {
file_now=ftitle[ii];
s_dis=sd_dis[ii];
ii =ii+1;
} while (ii<nfile && sd_dis[ii]<dis);
//
|
|
|
|
|
Well, of course ii=ii+1; cannot give such an exception, you have to check, using the debugger, for out-of-boundary array access, i.e. if ii happen to be 20 or more in code containing sd_dis[ii] or ftitle[ii] .
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]
|
|
|
|
|
Thanks for the comments:
I can not find anything like "if ii happen to be 20 or more in code containing sd_dis[ii] or ftitle[ii].". At ii=ii+1 the error pointed in the debudg at the following statement:
->> 00433872 mov dword ptr [ecx],edx
Thanks for the help
|
|
|
|
|
Could please post the whole error message (and the whole code snippet)?
What is the ii value when the exception occurs?
BTW the assembly instruction reported doesn't appear to be an integer increment operation: it seems more an array access.
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]
|
|
|
|
|
We used to use strncpy to protect the buffer when copying into it. Does strcpy_s totally take that over?
I know when I debug, that sometimes I get a runtime error inside strcpy_s when the source string is longer than the buffer.
Will this runtime error appear in a non-debug build?
And should I really be using strncpy_s() instead of strcpy_s()?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: And should I really be using strncpy_s() instead of strcpy_s()?
Only if you need to tell the function how many characters to copy.
"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
|
|
|
|