|
hi all masters
i use sleep(5); in vc++(MFC) but error is that undeclared identifier
is there any other way to declare it
|
|
|
|
|
p_ wrote: is there any other way to declare it
Maybe by using the correct function ? Use Sleep instead of sleep
|
|
|
|
|
|
Use this define
#define 5 1+1+1+1+1
codito ergo sum
|
|
|
|
|
Hi all,
I have a binary file. I want to read as it is(i mean ones and zeros), and at the same time need to store in an array. Here is the code I used to read the file.
<br />
ifstream file( "G00046_002_01.srf" ) ; <br />
file >> noskipws ;<br />
typedef bitset< numeric_limits<unsigned char>::digits > bitset ;<br />
unsigned char byte ;<br />
<br />
if(filebin.is_open())<br />
{<br />
while( file >> byte )<br />
{<br />
cout << bitset(byte) ; <br />
filebin << bitset(byte) ;<br />
}<br />
filebin.close() ;<br />
}<br />
Can you guys tell me how store those zeros and ones on an array. I confusing that working with dynamic data and arrays. Tried, but failed.
Hi all....
|
|
|
|
|
|
Thanks,
Actually I want to store that read bits on an array. That's the place I'm wired.
Hi all....
|
|
|
|
|
I have to check whether cts pin is on or off I tried the below code but no use
if(GetCommModemStatus(m_hPort,&dwCommStatus))
{
if(dwCommStatus & MS_CTS_ON)
TRACE("cts on \n");
if(dwCommStatus & MS_DSR_ON)
TRACE("dsr on \n");
if(dwCommStatus & MS_RING_ON)
TRACE("ring on \n");
if(dwCommStatus & MS_RLSD_ON)
TRACE("rlsd on \n");
else
TRACE("pins no response\n");
}
I am getting pins no response.
Any help is welcome
S.Yamini
|
|
|
|
|
Did you check that your CTS signal is high ? (with a voltmeter or an oscilloscope)
|
|
|
|
|
I checked before I connected the serial port cable to my computer.It showed +9v in the voltmeter and then i connected the serial cable but I am not getting any response or value.
S.Yamini
|
|
|
|
|
Then I don't really see... Are you sure that you the port is opened correctly (with CreateFile) and that you open the same port ?
|
|
|
|
|
Yes I am able to send Text and receive text but not able to monitor the cts pin
S.Yamini
|
|
|
|
|
If I remember right, RS232 uses a voltage feed of +-12V. And I know, from my own experience, that an open connector can give any state, it depends how the hardware is designed.
The question is: Do you get antoher result when you have a negative voltage on the cts pin?
Maybe you can try with a real modem, if you set DTR high/active, then RTS, the modem should respond with setting CTS high/active.
Again, if I remember right, "high/active" really means a negative voltage on the pin in question. But I might be wrong here, so you'd better check that piece of information.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
What is the value of dwCommStatus ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Everyone,
Am new to VC++.Am using list control(report type) to represent my data obtained from serial port.Am able to select the data in the list control but not able to copy. Should i need to write any code for copying data from control list.I don't want to copy the data to any other controls with in the project.What i need is to select the data in control list, press ctrl+c and copy the data to notepad/word.Please help me out.
Thanks in advance
|
|
|
|
|
shir_k wrote: Should i need to write any code for copying data from control list
yes you have to write the code for implement same. look this code for copying data in to clipboard memeory http://www.codeproject.com/clipboard/archerclipboard1.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
HI,
I went through the link u have sent that doesn't matches with my requirement.First thing is am using control list box and am not having any button to copy.What i need is
1) Select the data in the control list by using mouse
2)copy by pressing ctrl+ C
3)pasting in a notepad or word document(outside the project).
Thanks
|
|
|
|
|
Use accelerator for Ctrl + C. Thus you will get the event (Ctrl+C press) and follow as ThatsAlok said
- NS -
|
|
|
|
|
Could u plz tell me how to use accelerator for Ctrl+c
|
|
|
|
|
From within the IDE, press Ctrl+R and select Accelerator from the list of types. Click the New button. Double-click the newly added accelerator item. Check the Ctrl checkbox. Type a C in the Key combobox. Press Enter. You should now have a Ctrl+C accelerator key. Check out the LoadAccelerators() function.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
you have to handle WM_KEYDOWN message for ctrl+c and there you have to read the text from listctrl and copy that into clipboard.. which can be copied anywhere using ctrl+ v
|
|
|
|
|
Hi Guys,
Can u ppl please explain step by step how to do it.Sorry for the trouble.
Am writing code in MFC Application.
Thanks for the help i was able to do it.
-- modified at 1:33 Wednesday 12th September, 2007
|
|
|
|
|
I would like my UDP server to send the data when the client connects; say at a rate of 100 msec.
But I can only get it working when the Server does a receive first (so the client has to do a send) then the Server does the send.
Can this be done? The server fails if I do not do the Receive and the client fails if I dont run the server first.
See code below:-
while(g_bUDP_Socket_Created && g_bUDPStatus)<br />
{<br />
bytesRead = recvfrom (conn_socket, (char *)&RxBuffer, sizeof(RxBuffer), 0, (struct sockaddr *)&from, &length);<br />
if (bytesRead == SOCKET_ERROR) <br />
{<br />
g_szFormatting.Format("Couldn't receive data, %d",WSAGetLastError());<br />
::MessageBox((HWND)NULL,g_szFormatting, NULL,MB_ICONEXCLAMATION );<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
return -1;<br />
}<br />
<br />
retval = sendto (conn_socket, (char*)TxBuffer, sizeof(Tx_Data), 0, (struct sockaddr *)&from, fromlen);<br />
if (retval == SOCKET_ERROR)<br />
{ <br />
g_szFormatting.Format("Couldn't send data, %d",WSAGetLastError());<br />
::MessageBox((HWND)NULL,g_szFormatting, NULL,MB_ICONEXCLAMATION );<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
}<br />
}
|
|
|
|
|
Are you getting an error? If so, what is the error code returned by WSAGetLastError()?
Andy202 wrote: say at a rate of 100 msec.
That isn't a rate, that's a duration.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If I comment out the receive I get error 10057 on the send.
All I want to do is transmit a UDP message at 10Hz. The client can be running or not. I will use port 5001, but I do not need to know the client PC.
The client will need to know both Port and PC - correct?
Andy.
|
|
|
|