|
toxcct wrote: it wasn't when i wrote it
I know. In general, unless a thread changes mid-way into a managed question (or an unmanaged question) in the wrong forum, it's best to leave it for a day or two (without replying) so someone can move it to the right forum
Strange though that people can't even decide the correct forum to post their questions. They see the word 'C++' and bang - make their post!
|
|
|
|
|
i think also many people don't even know what managed C++ is (and whant managed actually means !!), and when one has a general question about C++, the fact that the main C++ forum contains "visual" in its name might tell them, "it's certainly not what i want to ask about, so, i'll go to the other C++ forum"...
|
|
|
|
|
It looks that the definition of class triangle has one "}" missing.
Best,
Jun
|
|
|
|
|
Hi,
This happens when you skip somewhere closing bracket "}".
Double check your source code.
|
|
|
|
|
1111-----1
1 11------
1111----1-
--------111
--------111
--------111
hi, as the previous question may not so easy to see, so i post the question out again here..
this is just only a example, and using C++ to solve plenty of these similiar example.
In this problem, you can ignore all the - simbol as they stand for the space only, and you can see that:
the hole formed inside many 1 consider call void element=V; here v = 1
two 1 which is quite far away from others is call exceptional element=E,here E = 2;
let the total number of 1 =A; here A = 22
i need to use the C++ to calculate the below result
S = (A-E)/(A+V)
for example this case s = (22-2)/(21+1)=0.91
So how to write a C++ program, to search for the void element V; the exception element E as well as the total number of 1 A and calculate the result??
i am so eager to know the knowledge about this, may anyone give me a hand???
Your great help will be appreciated!!, thank so much.
please send to my email sinbearzc@hotmail.com if you can give me a help, thank..
|
|
|
|
|
Your question is not clear at all. What are these spaces and '1' ? Is that data contained in a file that you need to read ? Or what ?
When describing a problem, try to imagine people reading you. What you describe is just too abstract for us to understand (at least, for me to understand )
sinbear wrote: please send to my email sinbearzc@hotmail.com if you can give me a help, thank..
No way, this is a forum so if we have an answer, we'll post on the forum.
|
|
|
|
|
sinbear wrote: the hole formed inside many 1 consider call void element=V; here v = 1
Here you mean this line 1 11------ yes? Did you make a mistake? Should the line be 1-11------ ? You say a hole inside many 1's. How many? In your example there are 3 1's.
sinbear wrote: two 1 which is quite far away from others is call exceptional element=E,here E = 2;
quite far does not explain enough. Do you mean when there is more than 1 space between the 1's?
Your example shows multiple lines. How exactly do you read the numbers? Are they binary or ASCII, does the file also contain lines (with a CLLF at the end of each line) or is it a continuous stream?
Before anybody can help you, you must answer all of my questions.
|
|
|
|
|
sinbear wrote: the hole...
What's a "hole?" Are you wanting to detect a space surrounded by 1 s?
sinbear wrote: two 1 which is quite far away from others...
What exactly does this mean?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
they must be very lonelly ones !!!
|
|
|
|
|
True. One is the loneliest number.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
111100001
1 1100000
111100010
00000000111
00000000111
00000000111
ok, now i change the - to 0, to try to explain this example more clear, this file will be print out in txt format, require the c++ to read from the txt file and also, it is the birnary format, and now can see that
the void V is the whole among the group of 1,
1111
1 11
1111
the two exceptional 1 E is locate at:
00001
00000
00010
which consider at not inside the group of 1
and like this
111
111
111
will consider as a group of 1
and so S = (A-E)/(A+V)
is this help to explain the problem? thanks
|
|
|
|
|
sinbear wrote: the void V is the whole...
What value does this "hole" have? Given that, just search for this value and you've found the void. Or, if you say that the file is comprised of only 0 s and 1 s, anything else would be considered a void. Correct?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all
I want to find out how to idendify if a string is unicode or ansi at run time.
Please help me ...
regds
Dharani
redindian
|
|
|
|
|
Your question is a little abstract, where does the string come from? As a rule, ansi characters are 1 byte, whereas unicode characters are 2 bytes. So you could simply use sizeof() to determine the string type.
|
|
|
|
|
If you're lucky, your Unicode text will start with a Byte-Order Mark byte sequence. If the text is UTF-16LE, it will start with the bytes 0xFF 0xFE in that order. If it is UTF-16BE, it will start with 0xFE 0xFF in that order, which will require you to swap the bytes to interpret it correctly with Windows functions. If it starts with 0xEF 0xBB 0xBF, it's UTF-8.
None of these encodings require the use of the Byte Order Mark. If it's not present, and you don't know the encoding of the string, I'm afraid the only method is to guess. Windows offers a function IsTextUnicode which can do this guesswork, but it can be fooled, with sometimes embarrassing results: see here[^] for one example.
Best practice is always to mark a protocol payload or file with the character set or encoding it was written in.
|
|
|
|
|
Hi
I have the following problem .
I have a CString csBuffer ;
At tun time , this csBuffer gets unicode and ansi values alternatively . The value is only numbers.
For example
At one time csBuffer holds "1234" and another time it holds "1.2.3.4" .
So when the value is 1.2.3.4 , WideCharToMultiByte works fine and we get a ansi string "1234".
But when the value is 1234 , WideCharToMultiByte should not be called .
So after your suggestion I did the following
int nFlags=IS_TEXT_UNICODE_SIGNATURE;
if (::IsTextUnicode(csBuffer,csBuffer.GetLength(),&nFlags))
{
..message box "Its a unicode string"
}
But in both the cases IsTextUnicode did not succeed .
What can I do now ?
In fact I am a newbie when it comes to uncode stuffs ...
Please help me ...
Dharani
redindian
|
|
|
|
|
You can't. If I give you a bunch of bytes that end with 0, there's no way to be 100% sure what encoding was used to produce that string. As Mike said, you can call IsTextUnicode() but don't expect perfect accuracy. If you need 100% accuracy, you need to specify the encoding separately from the data.
|
|
|
|
|
Hi
I have a CString which holds unicode / ansi values alternatively .
For example ..csBuffer = "1.2.3.4"; and csBuffer="1234";
I need to find a way to differentiate between both the occurances .
IsTextUnicode() did not succeed when I passed csBuffer to it.
Please advise me
redindian
|
|
|
|
|
hi all
i have developed a MFC app in VS2003, recently upgraded to VS2005
however when i send out my updated exe to customers, a message box pops up saying to re-install the application
so I have updated my deployment application to vs2005, but when this trys to install, it wants to install .net framework 2.0
i dont need to use the .net framework so i dont know why it trys to install
even if you let it update the .net framework after it has installed, i still get a message box pop up asking to re-install the application
im pulling my hair out here
does anyone have any ideas ?? or seen this type of thing before ?
thanks
Si
|
|
|
|
|
Hi Guys,
This question I asked earlier, but I could nt continue,
I want to make it clear, Is there any API by which we can know the local drives of our system ( A:, C:, D: etc )?
Please do reply guys.
Thanks in Advance
Velayudhan
|
|
|
|
|
velayudhan_raj wrote: This question I asked earlier, but I could nt continue,
I want to make it clear, Is there any API by which we can know the local drives of our system ( A:, C:, D: etc )?
Please do reply guys.
GetLogicalDriveStrings();
|
|
|
|
|
It is not completely successful.
It is just returning a single drive's name
Actually I want all the name's of all drives in my system.
Thanks in Advance
Velayudhan
|
|
|
|
|
velayudhan_raj wrote: It is not completely successful.
It is just returning a single drive's name
Actually I want all the name's of all drives in my system.
You should first read the documentation carefully
Quote from MSDN...
lpBuffer
[out] Pointer to a buffer that receives a series of null-terminated strings, one for each valid drive in the system, that end with a second null character. The following example shows the buffer contents with <null> representing the terminating null character.
c:\<null>d:\<null><null>
End quote...
I guess you are trying to assign to a string which terminates where it finds a null character, hence you are not able to get the whole drives.
|
|
|
|
|
Dear Velayudhan,
I am Listing in LisBox, u can display it in any control.
Here is the Code.....
unsigned long driveList = GetLogicalDrives();
char drivePathName[] = " :\\";
CString drive;
for(int i = 1;i<26; i++) //u can give no of drives in your system
{
if(0x01 & (driveList >> i))
{
drivePathName[0] = 'A' + i;
drive.Format("%c",drivePathName[0]);
m_List.AddString(drive);
}
}
With Best Regards
Vidya
S/W Developer,
AnnetSite,Mumbai
|
|
|
|
|
How to use this function
<br />
char *m_Name=new char[256];<br />
DWORD Lenght=255;<br />
GetLogicalDriveStrings(Lenght,m_Name);<br />
...<br />
...<br />
-- modified at 10:25 Wednesday 6th September, 2006
|
|
|
|