|
I said about bits. I have array[6]={0x7D 0x0c 0x2f 0x65 0xA5 0x4B}...
I should convert all Hex bytes to Binary format and then i should concatenate.
for Eg:0001111111111111, now i should mask the last three bits i,e 000.
|
|
|
|
|
if only the 3 bits are important for you there, you don't need to make all the concatenation stuff... only get the last byte (here 0x4B ), cast it into an int (char c = array[5] ) and mask it : c = c & 0x07
|
|
|
|
|
Yes, you are correct, just i used strcat(), it worked for me.
now i got one more problem, how can i represent a binary value of 11100001110 into a decimal?
|
|
|
|
|
srija wrote: ...how can i represent a binary value of 11100001110 into a decimal?
Are you wanting to know how to represent a base-2 number as base-10 instead?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Can i use atoi function????plz check this??
s[20]=11100001110
int power = 1;
int sum = 0;
for (int i = l-1; i >= 0; l--)
{sum += power * atoi(s[i]);
power = power * 2;
}
printf("%d", sum)
|
|
|
|
|
but atoi fuction si not working
|
|
|
|
|
Why go to all of this trouble when strtoul() will work just fine?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
yes, i need it so... the value of 11100001110. i,e some 1806 or so...
|
|
|
|
|
I am not sure what you mean with masking, but if you like to extract a hexadecimal value from a string and want to set the last 3 bits to 0 you can do it like this:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
char myHexString[] = "1A";
unsigned char myByte = 0x0;
sscanf(myHexString, "%X", &myByte);
myByte &= 0xF8;
printf("%d, 0x%x\n", myByte, myByte);
return 0;
}
Hope that helps you out.
Walter
-- modified at 7:55 Thursday 2nd March, 2006
|
|
|
|
|
Hello Friends !
I wanna to implement custom recordset (with dynamic fields,i.e. not from any table). Here I can do in VB as below :
'ResponseInfo is an ADODB recordset.
Public ResponseInfo As ADODB.Recordset
Set ResponseInfo = New ADODB.Recordset
Do Until <somecondition_overhere>
ResponseInfo.Fields.Append "FieldName", adVarChar, 250
Loop
ResponseInfo.Open
ResponseInfo.AddNew
'some blaa blaa
ResponseRs.MoveFirst
Do Until ResponseRs.EOF
'some blaa blaa code over here
ResponseRs.MoveNext
Loop
hope so, you've got what I wanna to do. Here I'm just building the recordset with dynamic field definitions, no query/table is used to build the recordset. So, I tried the same in VC++ (using #import "msado15.dll") , but it's not working. The open() requires the parameters, is there any other solution for this, so that i can build the recordset with custom columns (not building rset from any table/database).
Please get me some help...!!!
-Malli...!
|
|
|
|
|
you can specify the SQL query string to _RecordsetPtr after you build the table,like
m_pRecordSet->Open("Select name,caption from users", m_pConnectionString, <br />
adOpenKeyset, adLockOptimistic, adCmdText);
|
|
|
|
|
If we luanch console app from win app with createprocess() it returns immediatly while for example if console app takes several secs to execute can we make createprocess() run in blocking mode that is it should not return until console app terminates??
9ine
|
|
|
|
|
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
CreateProcess(
NULL,
"C:\\Windows\\Notepad.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi );
CloseHandle(pi.hThread);
// Wait until child process exits.
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
Steve
|
|
|
|
|
Great thanks.
But should we close thread handle before process is terminated?
9ine
|
|
|
|
|
Closing a thread or process handle doesn't terminate the thread or process.
Steve
|
|
|
|
|
The call to WaitForSingleObject takes a handle to the created process. The function waits until the object is signalled which occurs when the process exits so actually it does wait.
|
|
|
|
|
hello...
I am working on VC++ programming.....I want code for getting list of all Services running on computer
Plz help me..
Reply me as early as possible
Thanking You.
Sincerely,
VIRAL PATEL
|
|
|
|
|
Not sure if this is what you need
but a list of services installed can be seen here
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
if u want to get all the runnig process use the Api EnumProcesses()
nave
|
|
|
|
|
|
Hello i have a button if i press the button it should open explorer window and it should not show the D:drive its should be restricted to access.
how can i do that please help me
|
|
|
|
|
sundar_mca wrote: it should not show the D:drive its should be restricted to access.
http://www.codeproject.com/system/SysUtil.asp
"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
|
|
|
|
|
Hi people,
I need some help with IHttpNegotiate interface.
I have a BHO that also implements IBindStatusCallback and IHttpNegotiate interfaces. Also it implements IDispatch interface to catch DWebBrowserEvents2 . So in IDispatch 's Invoke method I create a URLMoniker , as url I pass the url entered in the browser and bind it to my instance of IBindStatusCallback. I was expecting that IHttpNegotiate 's BeginningTransaction method will get called for every request done by browser while loading the given url, I mean for requests to css,jscript,image, etc. but it only gets called for request done for the url itself. Can someone advise how to catch all the requests ?
Thanks.
Here is a bit of code where I create and register the URLMoniker:
<br />
STDMETHODIMP CIEPlugin::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,<br />
DISPPARAMS* pDispParams, VARIANT* pvarResult,<br />
EXCEPINFO* pExcepInfo, UINT* puArgErr)<br />
{ <br />
switch (dispidMember)<br />
{<br />
case DISPID_NAVIGATECOMPLETE2 : <br />
BSTR url;<br />
m_spWebBrowser2->get_LocationURL(&url);<br />
DWebBrowserEvents2 *pstm;<br />
IMoniker* ppmk;<br />
CreateURLMoniker(NULL, url, &ppmk); <br />
IBindCtx *pbc;<br />
CreateAsyncBindCtx(0, this, NULL, &pbc);<br />
RegisterBindStatusCallback(pbc, this, NULL, 0); <br />
ppmk->BindToObject(pbc, NULL, DIID_DWebBrowserEvents2,(void**)&pstm); <br />
break;<br />
default:<br />
break;<br />
}<br />
return S_OK;<br />
}<br />
HRESULT CIEPlugin::BeginningTransaction (LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)<br />
{<br />
MessageBox(NULL, bstr_t(szHeaders), "B", MB_OK);<br />
return S_OK;<br />
}<br />
|
|
|
|
|
Hi All,
when im closing a socket, the windows socket library ASSERTS.
when I debugged the code it is happening byb the following statment at CAsyncSocket::Close function.
"VERIFY(AsyncSelect(0))"
I could not find out the problem. can u help me?
regards
Sarath
Sarath
|
|
|
|
|
I'm trying to use the CWnd::CreateControl method to create an .NET UserControl. Everything is ok until the control (window) is closed.
It seems that it is some reference count problem because the code stops at an ASSERT in the CCmdTarget class.
I provide an example. The client is built in VS 6.0 and the usercontrol is built in .NET 2005.
http://www.codeguru.com/forum/attachment.php?attachmentid=14627
Anyone else that have had the same problem. Please help me with this.
|
|
|
|