I have created a dialog box in which I insert data about conductors (resistivity, permeability, diameter etc (electric power systems )) in edit boxes but I have done it only for 3 conductors. I have to insert-edit the number of conductors and then edit their characteristics. But I can't use again edit boxes because this is static. I want something like a dynamic table which will have rows=number of conductors and columns about is characteristic (resistivity, permeability, diameter)and edit them in dialog box. I don't know how to upload my executable to male clear what I have done but here is a part of my code for the static case of three conductors I want another dynamic way to edit data :/
Good Morning Sir,
can we use std::string for handling names like chinese letters, japanese letters? I mean we can use them for string comparison like "some chinese stuff"=="some chinese stuff" will it work?? Thank you sir for your time excuse my english
It depends what encoding you use for the Chinese characters. If it is Unicode then you need wstring, but if it's UTF8 then you will need to create a new type based on basic_string. Look at the samples in the link I gave you.
The function name CALL_MD5_Function indicates that it is calculating an MD5 hash sum. But that algorithm is a binary operation and usually requires passing a byte array and a length. With C/C++ char* pointers are often used to pass byte arrays (using uint8_t* would be better). So a char* is not always an indication for a string type.
You are calculating the hash for file names which use different encodings on different platforms (e.g. UTF-16LE on Windows and UTF-8 on Linux). In such cases you have to know (or define) which encoding has to be used for calculations of the hash sum. Then you have to convert the file name strings to that encoding before calculating the hash sum. If it is used only on a single platform, just cast the wide string pointer and pass the length in bytes (the length is missing in your function call; I assume it is just a wrapper to the real function passing strlen).
Finally, why do you want to get the MD5 sum of file names?
It is usually calculated for file content which is just binary.
No, sir the function will get the MD5 of the file itself, not for the names of the files. I am on a windows platform and this function is not going to be used for *nix platforms. so what shall I do sir
You can when using the appropriate char types and encodings.
Use std::string<char> (std::string is a typedef for this) for ANSI and multi byte encodings like UTF-8.
Use std::string<wchar_t> (std::wstring) for wide character Unicode strings. Note that this is platform dependant. With Windows, wchar_t is char16_t while it might be char32_t on other platforms.
It depends on your project settings (Unicode or ANSI / multi byte), the used encoding / code page if not a Unicode project, and what the library supports. If you have a Unicode build (recommended), there is probably also a Unicode version for the library.
If the library does not use the same encoding as your project you have to convert the strings.
Inside your program, the best way to represent characters is using the wchar_t-based types (e.g. std::wstring). This enables simple processing (all characters are represented by a single wchar_t value), and so on.
If you wish to call a library that only supports char-based types (e.g. std::string), you must convert whar_t types to char type, call the library, and convert the results back. In C++11, the standard way to do this is something like this:
Filenames, unfortunately, can be a problem. In order to work with multi-byte character filenames (rather than Unicode), you must convert them according to your Operating System's requirements. For Windows, this typically means using the crorrect Code Page for your system. See the WideCharToMultibyte() and the MultibyteToWideChar() APIs for details.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
Last Visit: 31-Dec-99 19:00 Last Update: 2-Dec-22 10:17