Convert System::String^ to char* array
-
Hello guys, I want to read the content of a textbox (a path) and then edit a file at this path. The type of textbox->Text is System::String^ but file manipulating functions all need char* type parameters. How can I cast the text of the textbox into a char* variable, or are there newer functions than fopen(), fprintf() and so on, which work with managed type variables? Thanks and best wishes, Manfred
-
Hello guys, I want to read the content of a textbox (a path) and then edit a file at this path. The type of textbox->Text is System::String^ but file manipulating functions all need char* type parameters. How can I cast the text of the textbox into a char* variable, or are there newer functions than fopen(), fprintf() and so on, which work with managed type variables? Thanks and best wishes, Manfred
Hi, in .NET you can do most of not all text processing using the String type; have a look at the File and/or FileInfo classes. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Voting for dummies? No thanks. X|
-
Hello guys, I want to read the content of a textbox (a path) and then edit a file at this path. The type of textbox->Text is System::String^ but file manipulating functions all need char* type parameters. How can I cast the text of the textbox into a char* variable, or are there newer functions than fopen(), fprintf() and so on, which work with managed type variables? Thanks and best wishes, Manfred
-
array<wchar_t>^ szArray = strPath->ToCharArray(); char buffer[50]={0}; int i = 0; for each(wchar_t ch in szArray) buffer[i++] = ch;
Nigah M Manzoor