|
|
Here is a very old (circa 1996) article that describes how to write an HTTP/1.0 server using MFC: "Write a Simple HTTP-based Server Using MFC and Windows Sockets" by Dave Cook, February 1996 issue of Microsoft Systems Journal, at http://www.microsoft.com/msj/archive/S25F.aspx[^]
|
|
|
|
|
|
Hello ,
I have defined a two dimensional array of type double in one of my MFC classes
in class 1:
double m_aCoefficients[10][20];
and now I want to make a pointer to this variable in another of my classes and assign address of this double array to that pointer.
so i have defined in class 2:
double* m_pCoefficients[10][20];
and in my CMyDoc Class I have tried this:
m_Class2.m_pCoefficients = (double*[10][20]) &m_Class1.m_aCoefficients;
but it gives error
Error 4 error C2440: 'type cast' : cannot convert from 'double (*)[10][20]' to 'double *[10][20]'
How can I resolve this?
thanks
|
|
|
|
|
|
Electronic75 wrote: double* m_pCoefficients[10][20];
Here you should have
double (*m_pCoefficients)[20];
After this you can write
m_Class2.m_pCoefficients = m_Class1.m_aCoefficients;
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Thanks Sandip It works fine
|
|
|
|
|
Hi Forum
I am new in this forum.I have a problem to store String variale in array.
I have two string CString A[100]and CString B.I want to store variable of B in A.Like that A=B.Can any one give some example.
Thxanks in Advance
|
|
|
|
|
LearnVC++MFC wrote: I have two string CString A[100]and CString B
A is not a string, it is an array of 100 CString objects.
LearnVC++MFC wrote: I want to store variable of B in A.Like that A=B.Can any one give some example.
What is the problem ? You need to assign it at a certain position in your array, something like:
A[10] = B;
|
|
|
|
|
Yes If B have some Values like "a","b","c".... then i want to store these values in A[10].I need some line of code..
Plz give me..
Thanks in Advance
|
|
|
|
|
Hi,
You may be mistaken about CString.
You can store a variable in CString object.
CString string = "Test String";
If you want to copy CString A to B;
Do CString A = "Test String";
CString B;
B = A;
Thats it..
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
No I am not misteke about CString.
CString B; variable change at the runtime.Let Us take example.First time CString B="As"; Secon Time It's values changes now it's values is CString B="Cs". So i want to store these variable in Array. Plz help me.
Forum every reply help US .Plz help me
Thx's in Advance
|
|
|
|
|
CString a[100];
CString b;
b = "As";
a[0] = b;
b = "Cs";
a[1] = b;
BTW probably a good C/C++ tutorial is needed.
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]
|
|
|
|
|
Thx's for reply.It's help me,but little more problem.
Sir CString b values came into runtime and every time it's value is new.And this code Every time store new values in a[0]and a[1].But i need to store all new values and don't want to delete Old values.Plz help me
|
|
|
|
|
CString a[100];
CString b;
int i=0;
b = "As";
a[i] = b;
i = (i + 1) % 100;
b = "Cs";
a[i] = b;
i = (i + 1) % 100;
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 gave you code in my previous reply. Do you know what a CString class does ? You know that you can actually store a full string (e.g. "Hello") in a CString object ? So, when you have something like CString A[100] , it actually means that you have an array of 100 CString objects (so, each one containing a separate string).
If you still don't know what to do, then please reformat your question because I don't get it.
|
|
|
|
|
Simple i want to store some String variable in CString A[100].Plz help me
|
|
|
|
|
My first reply gave you an example. Just store the string where you want in the array, what is the problem with that ? Did you try the code I gave you ?
|
|
|
|
|
Thx's I am try to do through that.
|
|
|
|
|
I think still i am not abel tell extact problem.I have a two string one is Array type and second one in simple String.And i want to store values os Simple string in String Array. I need some code example..
Thanks in Advance
|
|
|
|
|
LearnVC++MFC wrote: I have a two string one is Array type and second one in simple String
I guess the problem is that you don't understand the basics of C++. You don't have 2 strings, you have 101 strings: 100 are in a array (A) and one is alone (B). Please, review the basis and understand what an array is and what a CString is.
LearnVC++MFC wrote: I need some code example..
It would be much more easy for us if you explain EXACTLY what you are trying to do, because for now it doesn't make any sense to me.
|
|
|
|
|
Can you give me Some line of code how to store String Variable in String array.Plz give me
Thanks in advance
|
|
|
|
|
Oh my god. Is it a joke ? It's the third time you ask that and I gave you code in my first reply already.
|
|
|
|
|
Where you gave this one
A[10] = B; How will think it is code example..
Thanks very much for help like that...
|
|
|
|
|
LearnVC++MFC wrote: Where you gave this one
A[10] = B;
How will think it is code example..
1. That's exactly what you asked for.
2. If you don't recognise this as code you should reconsider your career choice.
LearnVC++MFC wrote: Thanks very much for help like that...
Your sarcasm is highly inappropriate. Cedric (and others) spent a lot of time trying to help you but you're simply too dense to understand.
|
|
|
|