| | |
convert cstring to char*
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
simply
c++ Syntax (Toggle Plain Text)
CString str = "Check"; char *my_char = new char[]; sprint(my_char,"%ls",str.GetBuffer());
To allocate n bytes of storage suitably aligned to represent any array object of that size or smaller. The program can define a function with this function signature that replaces the default version defined by the Standard C++ Library. The required behavior is the same as for operator new(unsigned int). The default behavior is to return operator new(n).
I apologize, May I ask u some question..
??? What the difference between :
??? In this case. Isn't it true that is same as :
??? What the difference between :
C++ Syntax (Toggle Plain Text)
char *my_char = new char(5); // and.. char *my_char = new char[5];
C++ Syntax (Toggle Plain Text)
char *my_char = new char(); // or... char *my_char = new char[];
Last edited by cikara21; Dec 18th, 2008 at 5:10 am.
> char *my_char = new char(5);
1 char, initialised to (char)5
> char *my_char = new char[5];
5 chars, initialised with the default ctor
> char *my_char = new char();
1 char, initialised with the default ctor
> char *my_char = new char[];
Does it even compile?
I've no idea what you get if it does.
I'm pretty sure that what it ISN'T is an infinitely large array you can appy write as much data as you want to without incident.
1 char, initialised to (char)5
> char *my_char = new char[5];
5 chars, initialised with the default ctor
> char *my_char = new char();
1 char, initialised with the default ctor
> char *my_char = new char[];
Does it even compile?
I've no idea what you get if it does.
I'm pretty sure that what it ISN'T is an infinitely large array you can appy write as much data as you want to without incident.
about
I just confuse with the statement below..
To allocate
but thanks..
char *my_char = new char[]; yes. it does compile...
I just confuse with the statement below..
To allocate
n bytes of storage suitably aligned to represent any array object of that size or smaller. The program can define a function with this function signature that replaces the default version defined by the Standard C++ Library. The required behavior is the same as for operator new(unsigned int) . The default behavior is to return operator new(n).but thanks..
![]() |
Similar Threads
- Another pigLatin question C++ (C++)
- type convert problem 2 (C++)
- Convert CString to char* (C++)
- Compression/Decompression Wave File to MP3 and Vice Versa (C++)
- Coverting varibles (C++)
- Array problems (C++)
- C++ CString Class Help! (C++)
- OOP char [8] to char (C++)
Other Threads in the C++ Forum
- Previous Thread: How to keep cursor on the same line after "return" is pressed?
- Next Thread: Newbe String Problem
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class code coding compile console conversion count data database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






