Tech Off Post

Single Post Permalink

View Thread: C# has Sytem.String. C++ (Win32) has TCHAR, LPWSTR, LPCWSTR, PCSTR, etc..etc..etc..
  • User profile image

    I've been a C# dev for several years...better part of a decade I guess. I'm a systems administrator by trade so rather than building web apps, I mainly use C# to do things that are out of the reach of vbscript. At least that's how it started. Now I have started spending more time with C++ because of an interest in systems level programming.

    Before anyone gets all indignant on me I know that Win32 was developed in C and not C++. I really don't want to argue about the pedigree of API's or languages.


    I guess what I'm wondering is how one gets over the hurdle of dealing with strings in native code and actually gets to a productive place like we are at with C# (or the rest of .Net). I'm really interested in C++ and native programming for the capabilities that it I guess what I would like is to be able to work with the native platform in a productive way.

    Libraries like poco and boost seem to have some features that simplify something's like filesystem  access...but I'm not really interested in portability. 

    For instance, Boost has a great recursive directory iterator. (Creatively named recursive_directory_iterator.) But once you have a file path if you want to know anything about it...the ACL applied, if the folder is encrypted via NTFS, or if it's junction/soft link/whatever you have to call Win32. Then starts the "you can't cast a blah to a blah to a pointer of a blahblah".


    Right now I keep butting my head against marshaling different types of strings in and out of Win32. Is there any chance that some of the C++ softies could give us some direction for how to navigate this? I don't really care about UNICODE or ANSI...I realize why there are functions that end with A and W. I'm not going to ship software in China anytime soon. I would need to actually turn out something useful first.

    I need to cut down on the friction here. Can anyone help?