|
Try running the program under the debugger, so that you can see where it stops. If the program stops in a library routine, chances are you have provided a bad argument value.
When you are debugging this sort of application, you really need to run both the client and the server in the debug environment, so you can tell what is happening.
Software Zen: delete this;
|
|
|
|
|
i need help in calling matlab functions from c++ i got some examples but when i implement them i get an error saying that <matlab.h> and many other library files are undeclared . So i want to know if <matlab.h> is already found on the VC++ complier or need to be included and if so where can i find it and how can i include it .
gobar
|
|
|
|
|
bPulseStream.add(0xdb);
bpulsestream is of type CBytearray
This is used to generate a 40Khz IR pulse.
Here's the full code -
#define CharWidth 73<br />
<br />
bPulsestream.Setsize(charwidth*4, 16); <br />
<br />
for(int i=0; i < charwidth*4; i++)<br />
<br />
{<br />
bpulsestream.Add(0xdb);<br />
<br />
}
Thanks in advance.
-hithesh
|
|
|
|
|
hithesh wrote:
Thanks in advance.
Thanks for what? You did not mention what you needed help with.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can someone explain why charwidth is 73 and why is bPulsestream 0xdb. If someone can decipher that code, it would be great.
-hithesh
|
|
|
|
|
The code snippet you provided, while syntactically incorrect, generates nothing and has nothing to do with IR pulses. It simply adds the value 0xdb to a CByteArray object 292 times.
You'll need to consult the source of this code to figure out how and why those specific values are used.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am using a read-only edit control to display a log file on a property page, but on w9x I am getting EN_ERRSPACE errors if the file is much over 62K. Now I can handle this by stopping reading the file at the 62K mark if running w9x, but I really would like a workaround to be able to display the entire file. I am using an edit control for it's built in text selection and clipboard support.
Would a rich edit control be better? or does it suffer from the same limitations?
What is the text size limit for w2k/xp? Do I also have to limit the log file on those platforms?
I have read in MSDN[^] that one can use the DS_LOCALEDIT dialog style (Can one use that style on a single property page, or does it then apply to all pages?) and the EM_GETHANDLE and EM_SETHANDLE messages to manage the memory yourself. But looking up DS_LOCALEDIT in MSDN[^] it says that DS_LOCALEDIT only applies to 16 bit windows, which makes it rather useless.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
PJ Arends wrote:
Would a rich edit control be better?
Yes.
PJ Arends wrote:
or does it suffer from the same limitations?
No.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks, rich edit control it will be.
Now I just have to figure out how to use one of them things
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I'm trying to write a Unicode Filename, both the filename and the data in the file are Unicode. I thought that I should use wofstream to do this. Does anyone know why wofstream only takes a const char * and not unicode? Is there another way to open a file to write to that I can use Unicode chars in its name?
This is the error I get from the following line of code.
wofstream outfile(pFileName);
error C2664: '__thiscall std::basic_ofstream<unsigned short,struct="" std::char_traits<unsigned="" short=""> >::std::basic_ofstream<unsigned short,struct="" std::char_traits<unsigne
d="" short=""> >(const char *,int)' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
There has to be a way to create a file with a unicode name or there is no point lol
thanks for any help regarding this.
|
|
|
|
|
I recently saw something like this, and was wondering what's the benefit.
struct MyStruct
{
// etc.
};
Later on in the program, I saw:
struct MyStruct* pMyStruct;
===================
What's the point of using the 'struct' keyword (a second time) to define a pointer to a structure that's already defined? It compiles fine, but what purpose does it serve?
Any sensible explanation will be appreciated.
William
Fortes in fide et opere!
|
|
|
|
|
It was required in C, but not in C++. Old habits die hard, I guess.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
You see quite a bit of C-style coding in C++. And I find that it just makes maintaining C++ even more horrible than it actually is.
Kevin
|
|
|
|
|
Yep. I cringe whenever I run across the old
typedef struct StructName {
} StructName; that I used to have to do in C all of the time.
Software Zen: delete this;
|
|
|
|
|
Hi,
I´m using VS.NET 2003 and I´m having some odd linking errors and I would appreciate if anyone could explain to me why, and how I could solve this.
I´ve done this simple example to show you what I mean.
car.h<br />
#pragma once<br />
#include <iostream><br />
using namespace std;<br />
<br />
void decfunc();<br />
char *msg;
car.cpp
#include "car.h"<br />
<br />
void decfunc()<br />
{ <br />
msg = new char[12];<br />
msg = "Hello world!";<br />
}
main.h
#include "car.h"<br />
using namespace std;
main.cpp
#include "main.h"<br />
<br />
void main()<br />
{<br />
decfunc();<br />
cout << msg;<br />
}
The link errors I receive are:
tests error LNK2005: "char * msg" (?msg@@3PADA) already defined in main.obj
tests fatal error LNK1169: one or more multiply defined symbols found.
Thanks!
|
|
|
|
|
add following lines to car.h:
#if !defined(_CAR_H)
#define _CAR_H
...
your previous code
...
#endif
so char*msg will be defined only once.
I hope it will help
Marcin Wojciechowski
|
|
|
|
|
Hi Marcin, thanks for your reply
acctualy, it didnt work. My car.h now looks as follows:
#if defined(_CAR_H)<br />
#define _CAR_H<br />
<br />
#include <iostream><br />
using namespace std;<br />
<br />
void decfunc();<br />
char *msg;<br />
<br />
#endif
and I still get the same link errors
error LNK2005: "char * msg" (?msg@@3PADA) already defined in car.obj
fatal error LNK1169: one or more multiply defined symbols found
I´m having a hard time seeing what makes it being defined twice.
Does it have something to do with the decfunc-function perhaps?
|
|
|
|
|
In car.h:
extern char *msg;
In car.cpp:
char *msg = NULL;
...cmk
Save the whales - collect the whole set
|
|
|
|
|
great! Thanks.
humpa humpa
|
|
|
|
|
I want to write a program to show a BMP , which is so big that the PC has not enough memory to load , can you give me some clews ? if you have the code please mail me , thanks a lot .
|
|
|
|
|
#include<iostream.h>
#include<iomanip.h>
#include<math.h>
void optimization(double x[3][2]);
double power(double x,int n);
double F(double x[2]);
double fun(double x[3][2],double xm[2] );
double a,k,b,v,E,p,q,y;
double x[3][2],fx[3],*xh,*xl,*xg;
double temp,fxh,fxl,fxg,fxm,fxr,fxe,fh1,fxc;
double xm[2],xr[2],xe[2],xh1[2],xc[2];
void main()
{
cout<<"输入边长值:"; cin>>a; cout<<"输入反射系数:"; cin>>k; //输入原始数据
cout<<"输入收缩系数:"; cin>>b; cout<<"输入扩伸系数:"; cin>>v;
cout<<"输入容差:";cin>>E; cout<<"输入的初始顶点:";
cin>>x[0][0]>>x[0][1];
p=(sqrt(2+1)+2-1)*a/(sqrt(2)*2); q=(sqrt(2+1)-1)*a/(sqrt(2)*2); //建立初始单纯形
x[1][0]=x[0][0]+p; x[1][1]=x[0][0]+q; x[2][0]=x[0][0]+q; x[2][1]=x[0][0]+p;
optimization(x);
}
double F(double x[2])
{
double f;
f=3*power(x[0],2)+power(x[1],2)-12*(x[0])-8*(x[1]);
return f;
}
double power(double x,int n)
{
int i; double p=1.0;
for(i<1;i<=n;i++)
p=p*x;
return p;
}
void optimization(double x[3][2])
{
fx[0]=F(x[0]); fx[1]=F(x[1]); fx[2]=F(x[2]);
for( int i=0;i<3;i++)
{
for(int j=1;j<2-i+1;j++)
{
if(fx[i]<=fx[i+j])
{
temp=fx[i];
fx[i]=fx[i+j];
fx[i+j]=temp;
}
}
fxh=fx[0]; fxg=fx[1]; fxl=fx[2];
}
for(i=0;i<3;i++)
{
if(F(x[i])==fxh) xh=x[i];
if(F(x[i])==fxg) xg=x[i];
if(F(x[i])==fxl) xl=x[i];
}
xm[0]=(xg[0]+xl[0])/2; xm[1]=(xg[1]+xl[1])/2; fxm=F(xm); // 计算反射中心
xr[0]=(1+k)*xm[0]-k*xh[0]; xr[1]=(1+k)*xm[1]-k*xh[1];fxr=F(xr); //计算反射点
if(fxr>=fxl&&fxr<fxg)
{
="" xh[0]="xr[0];xh[1]=xr[1];
" if(fun(x,xm)<e)
="" cout<<"最优解为:"<<xm[0]<<endl<<"最小值为:"<<fxm<<endl;
="" else="" optimization(="" x);
if(fxr<fxl)
="" xe[0]="(1-v)*xm[0]+v*xr[0];
" xe[1]="(1-v)*xm[1]+v*xr[1];
" fxe="F(xe);
" if(fxe<fxr)
="" xh[1]="xe[1];
" if(fun(x,xm)<e)=""
="" optimization(x);
="" }
="" else
="" }
="" if(fxr="">=fxg)
{
fh1=fxr<=fxh? fxr:fxh;
if(fxr<=fxh)
{
xh1[0]=xr[0];xh[1]=xr[1];
}
else
{
xh[0]=xh[0];
xh1[0]=xh[1];
}
xc[0]=(1-b)*xm[0]+b*xh[0];
xc[1]=(1-b)*xm[1]+b*xh[1];
if(fxc<=fh1)
{
xh[0]=xc[0];
xh[1]=xc[1];
if(fun(x,xm)
|
|
|
|
|
While you failed to indicate what mistakes needed correcting, I would suggest using more meaningful names than x, y, z, and variants thereof. Your code is next to impossible to read.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i make one program for ivrs purpose.in which for database connectivity i use CRecordSet class fuction .in which i access 6 TABLES at a time for data manipulation. at this time cpu goes 100% and upto 15 seconds exe hangup.so another user dont able to access this exe file .so plz tell me can i make data retrival fast by any other method
|
|
|
|
|
Hi
I suggest u to use another Thread for database retrival while ur main msg loop handle user and system msgs.
also if u make a single QUERY for 6 table if it is possible it make ur jobs faster.
Bye![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I need:
*) Get Handle of Main Window from process handle (I know the process handle).
or:
*) Get process info (i.e. process ID or handle) from a Window handle (I know the window handle).
any solution for 2 questions above is helpful - first is prefered.
thx
includeh10
|
|
|
|