|
Shilpi Boosar wrote: 1) When you save your text file as unicode than the first two character is BOM character i.e. 255 244 (UTF-16 Little endian).
I never save files with BOMs. On occasion I have had to go out of my way to insure that it didn't show up in XML streams because some processors wont handle them. That is probably because I only use UTF8 streams though.
Shilpi Boosar wrote: 2) When you save your text file as UTF-8 than the first three character is 0xEF,0xBB,0xBF
Actually with UTF8 you should never use a BOM. UTF8 is a single byte encoding so by definition there can be no ordering.
Not to mention that the unicode site specifically says to not do that. Search for "byte order mark" in the following.
http://unicode.org/faq/utf_bom.html[^]
|
|
|
|
|
char strUTF8[] = { unsigned char(0xEF), unsigned char(0xBB), unsigned char(0xBF),'\0' };
char str[4];
sprintf(str,"%c%c",255,254);
CStdioFile m_OutPutFile;
m_OutPutFile.Open(_T("C:\\ANSI.txt"),CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
m_OutPutFile.Close();
m_OutPutFile.Open(_T("C:\\UTF8.txt"),CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
m_OutPutFile.Write(strUTF8,strlen(strUTF8)*sizeof(char));
m_OutPutFile.Close();
m_OutPutFile.Open(_T("C:\\Unicode.txt"),CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
m_OutPutFile.Write(str,strlen(str)*sizeof(char));
m_OutPutFile.Close();
Ok run this code in any console application and check in which encoding format these files are saved.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Shilpi Boosar wrote: Ok run this code in any console application
Why?
Shilpi Boosar wrote: and check in which encoding format these files are saved.
And exactly what universally accepted standard are you going to use to do that?
|
|
|
|
|
Joel has an easy articlle[^] on basics of Unicode. I'd start with reading that.
|
|
|
|
|
I have a Handle to the Rich Edit Control of Wordpad application in my Keypad application. I want to directly access the Internal Data Structure for this Rich Edit Control without using Windows Messages .
I do not want to use any of the SendMessage PostMessage APIs or Windows Messaging as this exposes my typed data to keyloggers. How can I write directly to the Internal Buffer of Rich Edit Control ?
Kamal Jagesia
|
|
|
|
|
To my knowledge, no windows control, not just richedit32 but buttons, statics and everything can only be interacted with through the windows message pump.
Keyboard loggers generally work by installing keyboard hooks, which wont pick up these interactions, however it is possible (as Spy++ proves) to intercept the message pump however there would be so much data to sift through for the attacker that it wouldn't be a practical attack.
|
|
|
|
|
I'm not sure exactly what you are trying to do but you may wish to create your own class based on the
CRichEdit[^] class. You may then be able to gain access to some of the internals of the class.
I must get a clever new signature for 2011.
|
|
|
|
|
hello
please can any one help me. how to make point to Rect .
for example i had two point..
cpoint p1,p2;
now p1 has (x1,y1);
p2 is (x2,y2);
how to make it into Rect .....
thanking you
sarfaraz
|
|
|
|
|
CRect has a constructor which accepts two points: the top-left corner and the bottom-right corner, please check the MSDN documentation.
|
|
|
|
|
|
Hi dear..
First of all you have to take one CRect..
CRect rectangle;
rectangle.left = p1.x;
rectangle.top = p1.y;
rectangle.right = p2.x;
rectangle.bottom = p2.y;
|
|
|
|
|
1. Is it legal to use
#include<atlstr.h>
in a win32 native Windows Application.
2. Does using atlstr.h in Win32 Native Windows Application causes any kind of error.
<br />
Source Found on Internet:<br />
Starting VS 2003, you can use CString in non-MFC applications by including header atlstr.h:
Some Day I Will Prove MySelf :: GOLD
|
|
|
|
|
Yes you can use it.
1) If you create an application than one option for ATL i.e. "Add common header files for ATL" is displayed.If you select these than it automatically add this header for you.
or
2) You can use basic_string of STL, std::string, std::wstring as per your requirement.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
do std::wstring has trim function as CString have.
(Trim, LTrim, RTrim )
Some Day I Will Prove MySelf :: GOLD
|
|
|
|
|
No there is no built in functionality for trim in basic_string but you can make a function of it. Search on Google, you will get the better result
First link of google that have solution is :
Click here ->
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
thanx nice
Some Day I Will Prove MySelf :: GOLD
|
|
|
|
|
WC
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Indeed you may use CString in a Win32 application. However std::string might be a valid alternative.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
To begin, I'm enrolled a some programming classes at the my university, so I'm getting my C++ feet wet through experimentation. The following code generates a heap corruption error everytime I launch it.
#include<iostream>
using namespace std;
struct IntArray
{
int Iarray[0];
};
void main()
{
char end;
short num = 20;
IntArray* A = (IntArray*)new int(sizeof num);
for ( short i = 0 ; i < 10 ; ++i )
{
A->Iarray[i] = ( i * 10 );
}
for ( short j = 0 ; j < 10 ; ++j )
{
cout << A->Iarray[j]," ";
}
cin >> end;
delete A;
return;
}
This is the error that it generates before the program even starts to run:
"Windows has triggered a breakpoint in My Arrays.exe.
This may be due to a corruption of the heap, which indicates a bug in My Arrays.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while My Arrays2.exe has focus.
The output window may have more diagnostic information."
I following the exact procedures found in the MSDN article:
http://msdn.microsoft.com/en-us/library/0scy7z2d(VS.80).aspx
I'm trying to build array methods that I can understand.
Any idea on where I screwed this up will be helpful to the learning process.
|
|
|
|
|
Foothill wrote: IntArray* A = (IntArray*)new int(sizeof num);
Not sure why you are allocating memory for this from the heap. Since only one A is being used, just use:
IntArray A;
Foothill wrote: int Iarray[0];
This will only hold one int , not 10.
Foothill wrote: cout << A->Iarray[j]," ";
Perhaps you meant:
cout << A->Iarray[j] << " ";
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I'm trying to dynamically resize arrays at runtime so that I can make a self-addaptable code to handle a variety of needs. This was just the initial attempt. As far as 'why from the heap?', the MSDS example was the first destination following my first attempts at this so if there are other ways, I would love to know about them. BTW, thanks for the syntax correction help, switching my brain from Visual Basic to C++ isn't as easy as I thought it would be.
|
|
|
|
|
Foothill wrote: I'm trying to dynamically resize arrays at runtime
With the CRT, there was the realloc() function. Otherwise, it's not much more difficult, you just have to do more yourself. For example:
int *x = new int[3];
x[0] = 2;
x[1] = 4;
x[2] = 6;
int *y = new int[5];
memcpy(y, x, 3 * sizeof(int));
y[3] = 8;
y[4] = 10;
delete [] x;
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Perfect Answer 5 .
I love to read your answer because you explain the things perfectly
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Foothill wrote: I following the exact procedures found in the MSDN article:
http://msdn.microsoft.com/en-us/library/0scy7z2d(VS.80).aspx
Read it once, it is an example of "Compiler Error C2229".
The way David give is correct or you may use malloc and realloc.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Everyting but this line:
IntArray* A = (IntArray*)new int(sizeof num);
looks to be ok. (Well, you might want to use num instead of 10 in your loops)
int *i = new int(n);
will allocate space for one int, and initialize it with the value of n. Your case is like this, where n = sizeof num which is the number of bytes in a short, typically 2. This is not much of an array, even though you may access it as a single element array.
On the other hand
int *a = new int[n];
will allocate space for n int s. If you change your line to
IntArray* A = (IntArray*)new int[num];
your code will be alright.
|
|
|
|