Convertions ??
-
Hi all, Im trying the following, I have a character pointer and a char array, I'm trying to assing the value of the pointer to the array, with no luck, please help??
char* variable = "what ever";
functionExample(variable);void functionExample(char* variable)
{
char Value[] = variable;
}Thanx in advance ....
Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
-
Hi all, Im trying the following, I have a character pointer and a char array, I'm trying to assing the value of the pointer to the array, with no luck, please help??
char* variable = "what ever";
functionExample(variable);void functionExample(char* variable)
{
char Value[] = variable;
}Thanx in advance ....
Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
Programm3r wrote:
char Value[] = variable;
that is not legal C++. the easiest way to do this is with a string class of some kind:
CString Value = variable;
or
std::string Value = variable;
or, if you have to use a char array:
int iLen = strlen(variable);
char Value = new char [ iLen + 1 ];
strcpy(Value, variable);
Value[iLen] = 0;...
delete [] Value;
-
Programm3r wrote:
char Value[] = variable;
that is not legal C++. the easiest way to do this is with a string class of some kind:
CString Value = variable;
or
std::string Value = variable;
or, if you have to use a char array:
int iLen = strlen(variable);
char Value = new char [ iLen + 1 ];
strcpy(Value, variable);
Value[iLen] = 0;...
delete [] Value;
O.K ... Thanx for the response ... But why do I always get this error, I mean I am using:
using namespace std; error C2065: 'CString' : undeclared identifier
:confused::sigh:
Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
-
O.K ... Thanx for the response ... But why do I always get this error, I mean I am using:
using namespace std; error C2065: 'CString' : undeclared identifier
:confused::sigh:
Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
CString is not the STL std::string class. it comes from MFC.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
CString is not the STL std::string class. it comes from MFC.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
Thanx ... cause otherwise I would have wasted my life trying to figure out how to make that
CString
work.... :) X|Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
-
Thanx ... cause otherwise I would have wasted my life trying to figure out how to make that
CString
work.... :) X|Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
couldn't you just search the MSDN[^] ... ? ;P
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
couldn't you just search the MSDN[^] ... ? ;P
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
It was a joke.... :laugh::laugh: As if my world would end because of
CString
.... :) :)Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
-
Hi all, Im trying the following, I have a character pointer and a char array, I'm trying to assing the value of the pointer to the array, with no luck, please help??
char* variable = "what ever";
functionExample(variable);void functionExample(char* variable)
{
char Value[] = variable;
}Thanx in advance ....
Only programmers that are better than C programmers are those who code in 1's and 0's..... :) :) Programm3r
hello! All i want to ask about a modifiction of the below line i want to know is it right or wrong and why?
Programm3r wrote:
char Value[] = variable;
first:Programm3r has made a mistake here that he assigned a value var to a pointer. second: i think it may be
char value[]; &value[0] = variable;
thanks for your reply****************** ****************** ** Ahmed Ismail ** ****************** ******************