|
|
Floating point numbers used by computers can be only rational (have a limited number of digits). When storing irrational numbers, the stored value must be rounded. Numbers are also stored internally with base 2. So not all decimal numbers (base 10) can be represented as identical base 2 numbers (while the decimal number is rational, the converted base 2 number may be irrational).
See the section 'Representable numbers, conversion and rounding' in the Floating point[^] Wikipedia article for a more detailed explanation.
|
|
|
|
|
I mean, at run time, an exe file is loaded into memory.
then a MFC program's resources, like string tables, bmp pictures,user-defined text files are they allocated memory space address statically? and loaded/linked into process/program address space?
|
|
|
|
|
|
Hey there,
I have a MFC app that has a CDHtmlDialog embedded in it. During run time i update the HTML content from the C++ code. There's a IMAGE tag in the content and the SRC for the tag is updated multiple times in a second to show different images.
Basically i go over a WHILE loop in the C++ and call a JavaScript function to update the "src" for the "img" tag.
The issue am seeing is that, after running this code for a while the application kinda hangs and the system takes up lot's of memory.
I have no idea how to solve this, as all the code that's in the browser side of app is HTML & JavaScript. I looked through the C++ code plugged all memory leaks there.
Any suggestions on how to fix this?
Thanks in advance.
|
|
|
|
|
When you run the program in the debugger, if you exit the program normally, then the Output window in Visual Studio should show you a list of memory leaks that it finds. This may be helpful in tracking it down.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi, now I need to create a dictionary in an application.
The dictionary likes a text file,contains about 800 items, what I mean it likes a text file is that it don't need to change, once it be created, just like a configuration file.
Program need to read it, index one item and show a string linked to the item.
So I figure it be better to use a string table resource. but unfortunately, the index ID is beyond 65535. (given by others, and it is a standard) . I know I can decode the index ID to 0-800 range.
So I think maybe I can use a CMAP, but I wonder if CMAP is suitable, since CMAP every time program start, I need to create an object.
Appreciate any advices.
|
|
|
|
|
|
|
You might
or
- Prefix each string in the string table with the hexadecimal representation of its index.
Don't know which one is the ugliest...
Veni, vidi, vici.
|
|
|
|
|
Thanks,HEX is a good idea;
and could you explain the reason to Serialize it ?
|
|
|
|
|
Because you need to persist it. Unless you want to read the original text file all the times.
Veni, vidi, vici.
|
|
|
|
|
|
You are welcome.
Veni, vidi, vici.
|
|
|
|
|
Where I will find codes to make windows app with C++ involving DirectX and Xaml
Kishan Kumar
|
|
|
|
|
|
Windows functions with character arguments, currently are each in 2 modes, one for 1-byte characters (the old ascii characters from 0 to 255), and one for 2-byte characters (WCHAR etc) for the Unicode characters from 0 to 65535 (0x0000 to 0xFFFF). But there are Unicode characters defined that need to be in 3 bytes, e.g. 0x012000 to 0x01236E for cuneiform; I have already found a Wikipedia page that displays cuneiform characters, or would if I had a font for cuneiform. How do Windows C++ programs usually handle and read and write such exotica?
Wikipedia page for "Cuneiform"
|
|
|
|
|
Those characters fall into the Multi-byte Character Set (MBCS) types, and require fonts that can display them.
|
|
|
|
|
Are there any C++ functions to handle MBCS characters?
|
|
|
|
|
What specifically are you trying to do?
|
|
|
|
|
First you figure out what you want to do.
Second your figure out what character set or character sets (plural) you need to solve your problem.
Third you determine what technology you need to solve that problem.
At best you haven't identified the second part of the above. At least you haven't stated what character set you think you will be working with.
|
|
|
|
|
The printf function has a version that prints one-byte characters, and a version that prints two-byte characters. Similarly with many other Windows C++ functions. But if I want to print a cuneiform character to screen, that is a 3-byte Unicode character, am I advised to stick to one-character mode and myself make the byte sequence to make Unicode go into the mode for 3-byte characters, and then to send the 3-byte character as three one-byte characters?
|
|
|
|
|
Anthony Appleyard wrote: that is a 3-byte Unicode character
You are confusing the conceptual with the practical.
"Unicode" in its broadest sense is an attempt to regularize how characters are used in computing.
It does that by defining characters. Those characters are then represented in character sets. There are quite a few of those (although less than the number of sets without the standardization of unicode.)
Following are two examples of character sets.
http://en.wikipedia.org/wiki/UTF-8[^]
http://en.wikipedia.org/wiki/UTF-16[^]
And those are just what is supposed to be in the data and doesn't say anything about whether any given technology X will support them partially much less fully.
You seem to be suggesting that you might be attempting to use UTF16. However I am rather certain that there are variants of that.
|
|
|
|
|
jschell wrote: You seem to be suggesting that you might be attempting to use UTF16. However I am rather certain that there are variants of that.
I have successfully read and printed and displayed on screen the 2-byte Unicode characters, in a C++ application called Typecase which I wrote, which is somewhat like Windows Character Map; it outputs by putting its text output in the clipboard. I have successfully output Unicode text to UTF16 mode files.
|
|
|
|
|
As I stated there are variants to UTF16. I am rather certain that one does not have any extensions at all. Another uses a two bytes (a range of two bytes) to specify that the following two bytes are used together (4 bytes) to create a code point.
I believe there is a variant of UTF8 that can have a 3 byte character code point. But I am not as clear that there is a UTF16 that does.
|
|
|
|