|
wchar_t are used to store "wide characters" (characters using an encoding that requires more than a byte). The most common used character encodings for wchar_t are UCS-2 (a subset of UTF-16) and UTF-32.
Read Unicode - Wikipedia[^].
|
|
|
|
|
|
It's defined as a wide char for Unicode & UTF16 support primarily for filename name support (FAT32 LFN for example) and foreign console input.
There is also another important type in <wchar.h> which is wint_t which is the generic carrier form.
You need the concept of narrowing which take a wide character back to it's byte approximation (see function wctob).
wctob | Microsoft Docs[^]
The reverse concept is widening which takes a byte character and promotes it (see function btowc)
btowc | Microsoft Docs[^]
The letter conversions are controlled by the current LC_TYPE locale meaning the language type
Type something like this .. it prints the time in japanese
#include <wchar.h>
#include <locale.h>
#include <time.h>
int main(void){
wchar_t str[100];
time_t t = time(0);
setlocale(LC_ALL, "ja-JP");
wcsftime(str, 100, L"%A %c", localtime(&t));
wprintf(L"%Ls\n", str);
}
It will look something like "金曜日 2017/12/15 2:09:13"
In vino veritas
|
|
|
|
|
Newer versions of Visual Studio are installed without a makefile for the MFC library.
As I want to change some inner parts of MFC I need to compile the library.
...but without a makefile (or solution file) this is not possible.
Anybody out there which has got a working makefile for newer Visual Studios?
Regards,
jung-kreidler
|
|
|
|
|
jung-kreidler wrote: As I want to change some inner parts of MFC I need to compile the library. Is this something you've (had) done before?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes, some years ago with an older version of MFC as there was a bug inside...
Thanks for the response.
|
|
|
|
|
Don't, it could lead to all sorts of problems. A much better idea is to add your changes by subclassing the classes that you need to behave differently.
|
|
|
|
|
The reason for trying to get the hands on the MFC source are necessary changes (public vs. protected...) in the feature pack. Subclassing it not possible as the corresponding classes are already subclassed by the MFC feature pack itself. So, there's no access to the inner parts.
Thanks for the response!
|
|
|
|
|
Hi,
Note that I have not used MFC since ~2013 but I can tell you that you can simply copy the MAK files from the VS2008 installation folder into your VS2010-VS2012 source folder and make a few changes. I have never attempted for VS2013 and above.
I believe the last version that supported recompile of the MFC framework was VC2008 with 'nmake /f atlmfc.mak MFC' from commandline. Beginning with version MSVC2010 the MAK files were removed and recompile of the library became completely unsupported.
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you all for answering. I did the VS2008 makefile way. There were a lot of new afx...cpp files to add. It did compile (and yes, it worked fine at a first glance) and I tried to go further into the replacement of some feature pack subclassed windows. Finally I've stopped as there were too many changes necessary, which might cause side effects.
Just wanted to get the beautiful MDI tear off feature of newer VS.
|
|
|
|
|
Hi,
I have created a system level service which needs APPDATA folder path which is different for each user. Is there anyway through which I can get the logged in user APPDATA folder path?
|
|
|
|
|
It is possible to get the name of logged in users from a service (you have already asked that and got an answer). Using that you can guess the the user directory path and verify it by checking if the pathe exists.
But a service should not modify user data and usually does not need to read user data.
You have not told us why you need access to user directories. Maybe there is a better solution for your problem.
|
|
|
|
|
Just a guess, since I never did it yet:
- enumerate currently logged i user using NetUserEnum or/and NetWkstaUserEnum functions to get the SID for every user;
- use these SIDs to get info for every user from registry (HKEY_USERS\<sid>\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
- ...
Hope, it helps (at least to move you in some potentially useful direction).
|
|
|
|
|
There is an environment variable named 'APPDATA' which has a full path.
You can get any environment variable.
So would that not be sufficient?
|
|
|
|
|
That is local to the user, not available to a service.
|
|
|
|
|
I see - that makes it clear.
|
|
|
|
|
john5632 wrote: Is there anyway through which I can get the logged in user... Multiple users can be logged in at once.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
hi,
The default integer declaration assumes a signed number. But when i tried
unsigned int a=-26;
printf("\n%d",a);
it printed "-26" only. Why?
|
|
|
|
|
Hi,
It is undefined behaviour because you have used wrong format specifier. Use %u instead of %d for unsigned int. like :
unsigned int a=-26;
printf("\n%u",a);
|
|
|
|
|
Thanks. Is it only about the format specifier? Or some other conversion happens inside?
|
|
|
|
|
Yes correct. If a conversion specification is invalid, the behavior is undefined.
If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined.
|
|
|
|
|
No, it is most definitely NOT undefined behavior. This is exactly the behavior one should expect. The variable a has the binary value of -26 decimal, or 0xFFFFFFE6 in 32-bit hexadecimal. When it is passed to printf with a %d format specifier it will be interpreted as a signed decimal value and -26 is printed. There is nothing undefined about that. It is interpreting the variable exactly as the format specifier is defined to. It may not be what you want but it is as expected.
|
|
|
|
|
Rick York wrote: It may not be what you want but it is as expected.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Introduction to the data:
NOAA's National Centers for Environmental Information collects global climate data and aggregates this data to provide information on climate trends and variability. One product they offer is a monthly regional analysis. The following table gives "anomaly" data by continent for January 2017. "Anomaly" means the value is the temperature difference from the average temperature from years 1910–2000.
Continent Anomaly (C)
North America 3.18
South America 1.36
Europe -0.12
Africa 0.53
Asia 1.92
Oceania 0.98
Assignment task:
Your task is to develop an algorithm that would sort data such as these from least to greatest. Specifically, given an unsorted set of N decimal values, your algorithm should sort them to give an answer of the sorted data. For this set of N = 6, your algorithm should produce:
-0.12
0.53
0.98
1.36
1.92
3.18
Execute your algorithm for a different set of data, such as a subset of the given data, data you make up, or another month's climate data, such as February 2017: https://www.ncdc.noaa.gov/sotc/global-regions/201702
Does your algorithm work for any N? Have you thought of corner cases it might need to handle, such as N = 0 or N = 1?
|
|
|
|
|