|
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
|
|
|
|
|
WhiteSky wrote: How to use this file
What file?
"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
|
|
|
|
|
function
|
|
|
|
|
Fair enough. But the OP already knew how to use the function. He was troubling parsing the resulting buffer.
"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
|
|
|
|
|
Each drive letter is separated by a nul character. Try:
char szDrives[105] = {0};
GetLogicalDriveStrings(sizeof(szDrives), szDrives);
char *pToken = szDrives;
while (*pToken != '\0')
{
cout << pToken << endl;
pToken += 4;
}
"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
|
|
|
|
|
Is There any short way to remove some lines from a file say there is a file called
Hello.dat contains 5000 lines
1) In that i just want read first 200 lines
2) Preform some operation
3)remove them i.e. 200 lines if the operation is proper //This is the problem
Some efficient was i.e. without creating another file i.e. new file
Payal
|
|
|
|
|
payal335 wrote: Some efficient was i.e. without creating another file i.e. new file
you have too make a new file for this.. there is no other option!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|