|
ok let me zoom out a little:
I have the sequence of bits:
0 101010101 0 101010101 0 101010101 0 10101010 0 ...
First I have to strip the lone 0's.
With the remainder bits I have to form numbers, and then write them (the obtained values) into a file.
As there are 9 bits used for every value, I will have to format these numbers on 16 bits (so to meet the byte boundaries). The first bit is important, as it gives the sign information (positive or negative).
It is obvious that the suggestion to test bits and write characters of 0 or 1 is the simplest approach, but it won`t help me further ahead... Sorry for not providing a complete explanation (so far)
|
|
|
|
|
What do you mean with sequence of bits (is your record size 10 bits, i.e. leading '0' plus 9 data bits, so that 8 of your records fit in 10 bytes?)?
And if you record has fixed size, what is the purpose of the leading '0' (the 'delimiter')?
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]
|
|
|
|
|
Greetings Pallini (and thanks again for your interest, you seem invaluable to this community)
Uhm... the hypothesis with one 0 every 10 bits was given to me by my superiors. I raised the question that you`ve raised (why one 0 every 10 bits if we know that every value is encoded in 10 bits) but they didn`t know the answer, just that "this is how it is".
I have tried observing the sequence of bits, but every editor I come across interprets and displays values in Hex format (I know the basics but I am not comfortable working with it, it takes me lots of more time than binary, especially on this data set)
Though, at a first glance, at least the beginning of the file does not follow this rule. I have uploaded a file for you if you have time to check it for yourself.
http://www.dump.ro/fisiere/100-dat/104015/o5tzJNoMT65asCMx
before going ahead working on this, I wish I see the bits and from there to decide what to do next. I am going to take the "test bit by bit and write chars into a file" and come back when going to conversion
10x for you help
|
|
|
|
|
The following silly program represents the first N bytes of your file as a binary string. I can't find the patterns you've described, anyway... I good luck!
#define N 80
void main()
{
int i;
int k;
int count;
char c;
FILE * fp = fopen("100.dat", "rb");
if ( !fp) return;
i=0;
for (i=0; i<N; i++)
{
unsigned char b = fgetc(fp);
for (k=0; k<8; k++)
{
c = b & 0x80 ? '1' : '0';
b <<= 1;
printf("%c",c);
}
i++;
}
fclose(fp);
}
BTW with such a 'detailed specification' of the file format what is expected from you? I would throw to your superiors a big chunk of random data...
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]
|
|
|
|
|
Hi There.
I am trying to get a caption of a windows control using below code... But its fatching only a set of square boxes (Carriage return).
TCHAR buf[512];
::SendMessage(pWaitingProcessCompleteWnd6, WM_GETTEXT, 0 , (LPARAM)buf);
I have checked the address of pWaitingProcessCompleteWnd6 using spy++, its pointing to the right control.
Please help.
Thanks
PanB
|
|
|
|
|
PankajB wrote: But its fatching only a set of square boxes (Carriage return).
How are you verifying this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
How about using GetWindowText[^] instead?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process, which makes GetWindowText() unusable.
Of course, I'm only assuming things.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process
Ahh, I missed that one.
You're probably right Rajesh.
Rajesh R Subramanian wrote: Of course, I'm only assuming things.
Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts....
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts.... Wink
[Sylverster Stallone tone] Well, it's tough answering questions here. They give me a war that I cannot believe in. [/Sylverster Stallone tone]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Sylverster Stallone tone
Hey man, you're too young to remember Sly.
--Carlo Rocky Rambo.
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]
|
|
|
|
|
There you go, changing your middle name again.
Warm regards,
Rajesh "Neo" Subramanian.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Actually, you can use GetWindowText on windows which belong to a different process.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: Actually, you can use GetWindowText on windows which belong to a different process
Well, read the subject line of the post again and you'll find it mentions "window control".
Then have a look at the documentation I linked to in my post where it clearly says "GetWindowText cannot retrieve the text of a control in another application".
But, then I'm just assuming the OP really meant a control when he wrote it....
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Please read the whole conversation before adding your comments. We're talking about a control that is owned by another process.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I did read the whole conversation, but maybe i misunderstood something...sorry about that...
I thought by "window control" you meant things like buttons or edit boxes on windows, and as far as i know you are able to get the text of those, or at least some of them, some controls, like buttons allow you to query their windowtext over process boundaries, while some don't. But i guess you meant something else, sorry...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
No worries, there's no need to apologise if you have read the whole conversation before adding your comments.
You can have a look at the Remarks section of the respective documentation page[^] to know what I'm talking about.
Here[^] is a detailed explanation.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi all,
i m working on VS-2008,and os is windows vista.
in case of UAC enable on Windows Vista, when i run my application its show a dialog box to allow or cancel the process.
i want when i run it,its always run like Administrator with full rights.
please tell me how can i do this.
thhanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Modify your Manifest property from
Project Properties->Linker->Manifest file
Change UAC Execution Level to "Require Administrator".
See this[^]
|
|
|
|
|
So...you want your application to run with full administrative rights without the user knowing that it's running as administrator. Sounds a little insecure to me...which is probably why MS don't let you do it.
Anyway - this page[^] has a workaround, of sorts.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi to all.
I'm trying to sort strings which contains some eastern European specific letters.
I'm sorting with qsort function:
qsort( (void *)polje, (size_t)cnt, sizeof( char * ), compare );
where 'compare' is a helper function int compare( const void *arg1, const void *arg2 ) which uses '_stricoll' function.
Wen running my test app sorting doesn't work.
I then tried to set local settings like this on OnInitDialog():
char* locale;
locale = setlocale(LC_ALL,"Croatian");
locale returns "Croatian_Croatia.1250"; but sorting still isn't working, why?
Thanks in advance
|
|
|
|
|
All I can suggest is splitting the problem into smaller parts. First, check that _stricoll (and thus your compare function) compare strings as you would expect.
After that...well, can you confirm that polje is of type char* polje[] , i.e. an array of character pointers?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for replay, code:
CString *polje = new CString[cnt];
for(int i=0; i<cnt;i++) {
CString pom;
m_List.GetText(i,pom);
polje[i] = pom;
}
qsort( (void *)polje, (size_t)cnt, sizeof( char * ), compare );
I have a list box control where user can add strings for sorting. Posted code is extracted from OnOK()!
|
|
|
|
|
Right...well, that sizeof(char*) in the qsort call isn't going to be correct, is it?
I would suggest:
- Change compare so it expects its two parameters to be pointers to
CString - Change the
sizeof( char* ) to be sizeof( CString )
And here's a thought - if you used STL containers, you could use type-safe algorithms and things that would highlight these issues...
std::vector<cstring> polje(cnt);
for(int i=0; i<cnt;++cnt)
{
CString pom;
m_List.GetText(i,pom);
polje.push_back(pom);
}
std::sort(polje.begin(), polje.end(), compareFunction);</cstring>
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|