Thank you Baerten, My problem was in C++, the code you show is C#. I have since worked it out the hard way (never did find any good documentation). In C++ the correct use is: String^ data = "one,two,three"; array<>^ separator = {','}; array<>^ parts; parts = data->Split (separator);
As you can see, C++ syntax is just a bit opaque, (there should be just single arrow symbols where I show double). The module using this works fine for me now. However, now it causes a memory corruption in old legacy code that has worked for years. --- I'm not even sure how to describe it to forma help question. Such is life. Thank you again, and welcome to the world inside!!
LudwigKeck
Posts
-
String.Split - tutorial? samples? -
The Average DeveloperI just celebrated my fiftieth year as a coder. And just about every year I had to learn something new -- and often a new language (yes I started before Fortran). Why I get a kick out of doing it I don't know myself. There is a great deal of satisfaction in getting something to work, sometimes just a little program that provides some information, sometimes getting a factory running. Maybe it is addictive. You won't be surprised to know that I enjoy classical music (as my son says - yeah, back then that's all you had). My daily routine is chaos - is there another way? :-D
-
String.Split - tutorial? samples?Can someone please direct me to a tutorial and/or samples on the use of the String.Split method? (I seem to have problems translating C# help info for use with C++.) LudwigKeck
-
Printing Problem - Console App - C++ - VS2005I need a console app (it is called from various other programs) that processes some data from various files and at times needs to send data to a (let's say generic text) printer with some printer control instructions. I cam across a sample in the help files with starts: :(
// RawDataToPrinter - sends binary data directly to a printer // // szPrinterName: NULL-terminated string specifying printer name // lpData: Pointer to raw data bytes // dwCount Length of lpData in bytes // // Returns: TRUE for success, FALSE for failure. // BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount) { HANDLE hPrinter; DOC_INFO_1 DocInfo; DWORD dwJob; DWORD dwBytesWritten; // Need a handle to the printer. if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) ) return FALSE; .....
This seemed to do what I need. I included WinNT.h and then the fun began: Compiling just presents a long list off errors in the WinNT.h file: c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C2146: syntax error : missing ';' before identifier 'WCHAR' c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(273) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(276) : error C2143: syntax error : missing ';' before '*' and many others. Any ideas? Suggestions? -- Honestly I have not yet started to celebrate the new year! Ludwig