|
hi maxwell Chen,
we use this to convert hex number but i am not getting how to declare that function why that $ is used..
Hex_Dec(Mid("FFFFFFFFFFFF", 1, 2), 1)
thanku
savitri
|
|
|
|
|
savitri wrote: we use this to convert hex number but i am not getting how to declare that function why that $ is used..
I don't quite get what you meant, and I do not read VB code / syntax.
I guess you are going to format a byte value in hexadecimal display. There are some existing functions for this job. You don't have to write your own.
Take a look at itoa function.
Or you can use the below:
char sTmp[10] = {0};
char val = 0xAB;
sprintf(sTmp, "%X", val);
Maxwell Chen
|
|
|
|
|
savitri wrote: but i am not getting how to declare that function why that $ is used..
Appending the identifier type character $ to any identifier forces it to the String data type.
So you neither know VB.
|
|
|
|
|
savitri wrote: Hex_Dec(val$, ByVal start As Byte) As Byte, how shall i declare the same fuction in VC++.
May be the following useful,
BYTE Hex_Dec(TCHAR *val, BYTE start);
But function and variable declaration are basics you need to learn these language constructs. Refer book, online tutorial, and compare with VB.
|
|
|
|
|
dear all
i would like to convert RGB image to grayscale, however i couldn't, how to convert y = Rx0.3+Gx0.59+Bx0.11) below?
int iWidth=m_vicImg.endx-m_vicImg.stx+1;
int iHeight=m_vicImg.endy-m_vicImg.sty+1;
int iBuffwidth=m_vicImg.buffwidth;
unsigned char *ucImgdata=m_vicImg.ibuff;
for(int iY=0;iY<iheight;iy++)>
{
for(int iX=0;iX<iwidth*3;ix+ mode="hold"> {
ucImgdata=(0.3*ucImgdata[iX+2] + 0.59*ucImgdata[iX+1] + 0.11*ucImgdata[iX]);
}
ucImgdata+=iBuffwidth;
}
error C2440: '=' : cannot convert from 'double' to 'unsigned char *'
i know ucImgdata type is different with what we signed in left, but i can't do correctly. anyone help me, thanks
Li Zhiyuan
|
|
|
|
|
li zhiyuan wrote: ucImgdata=(0.3*ucImgdata[iX+2] + 0.59*ucImgdata[iX+1] + 0.11*ucImgdata[iX]);
error C2440: '=' : cannot convert from 'double' to 'unsigned char *'
may be the following useful,
ucImgdata[iX+2] = ucImgdata[iX+1] = ucImgdata[iX] =(0.3*ucImgdata[iX+2] + 0.59*ucImgdata[iX+1] + 0.11*ucImgdata[iX]);
but i think the current available code is not written yourself. you need to be familiar with basic array, pointer concepts.
|
|
|
|
|
Rajkumar R wrote: but i think the current available code is not written yourself. you need to be familiar with basic array, pointer concepts.
People here keep telling him this, but he just doesn't listen ...
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: People here keep telling him this, but he just doesn't listen ...
Right you say...!but could we try to find why yuo he don't want to listen.. any language problem, since by name he seems to no english speaking country!
"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/codeProject$$>
|
|
|
|
|
ThatsAlok wrote: but could we try to find why yuo he don't want to listen.. any language problem, since by name he seems to no english speaking country!
If I recall correctly, "li zhiyuan" is from China and now lives in Malaysia.
Maxwell Chen
|
|
|
|
|
ohh great!
"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/codeProject$$>
|
|
|
|
|
You code still doesnt look correct enough. In image processing, normally we write in this way;
x_start,y_start, x_end, y_end are the coordinates for your ROI (Region of Interest)
Also note, the RGB image is 24-bit (hence the 3 = 24/8). Array indexing is used as x*depth + y *depth*image width (not region width)
Also note, on IA-x86 (Intel Arch), RGB in memory comes as BGR
for(int y = y_start; y < y_end; y++)<br />
for(int x = x_start; x < x_end; x++)<br />
{<br />
pImageGray[x+y*width] = pImageRGB[x*3 + y*width*3 + 0]*0.112 + pImageRGB[x*3 + y*width*3 + 1]*0.59 + pImageRGB[x*3 + y*width*3 + 2]*0.33;<br />
<br />
}
|
|
|
|
|
li zhiyuan wrote: error C2440: '=' : cannot convert from 'double' to 'unsigned char *'
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
some website ask you to input some identify code
But I don't know how to identify the code,
could you help me ?
Could you give me some code?
Thank you
|
|
|
|
|
What on earth are you talking about ? Do you mean CAPTCHA ? The reason they do that, is to stop people from being able to 'identify' them with code.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am trying to use POST url to the server using CInternetSession ,CHttpConnection,CHttpFile
But I am getting exception when excuting EndRequest
The format i have to post is:
POST /axis-cgi/audio/transmit.cgi HTTP/1.0\r\n
Content-Type: audio/basic\r\n
Content-Length: 9999999\r\n
Connection: Keep-Alive\r\n
Cache-Control: no-cache\r\n
\r\n
<Audio data>
<Audio data>
<Audio data>
My Code is :
CInternetSession session;
CHttpConnection *m_pConnection;
CHttpFile* pHTTP;
CString strPreFileData;
strPreFileData = "Content-Type: audio/basic\r\n";
strPreFileData += "Content-Length: 9999999\r\n";
strPreFileData += "Connection: Keep-Alive\r\n";
strPreFileData += "Cache-Control: no-cache\r\n";
strPreFileData += "\r\n";
CFile fTrack;
if (FALSE == fTrack.Open(strFullPath, CFile::modeRead ))
{
AfxMessageBox(_T("Unable to open the file."));
return FALSE;
}
dwReadLength = fTrack.Read(pBuffer, 200);
m_pConnection=session.GetHttpConnection("10.200.11.63", (INTERNET_PORT)80, "root", "root");
pHTTP = m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "axis-cgi/audio/transmit.cgi");
pHTTP->AddRequestHeaders(strPreFileData);
pHTTP->SendRequestEx(240,HSR_INITIATE,0);
pHTTP->Write(pBuffer, 240);
pHTTP->EndRequest();
Please Help me regarding this
S.Yamini
|
|
|
|
|
Hello everyone,
We alway meet with the term reallocation, but after some deep thinking, I am confused what exact definition of what means reallocation. Here is some statements from the book The C++ Standard Library as quoted below.
My two questions,
1. How do you understand the term reallocation in the book quoted section?
2. Are there any standard definition for reallocation?
My understanding, reallocation means making storage larger or smaller (or making the same size, but different address? not sure?), whether or not it involves free existing memory (e.g. vector) or not (e.g. deque) depends on internal implementation. It is hard to find a suitable definition for reallocation, if you have, please share with me.
section 6.3.1 Abilities of deques
--------------------
Deques provide no support to control the capacity and the moment of reallocation. In particular, any insertion or deletion of elements other than at the beginning or end invalidates all pointers, references, and iterators that refer to elements of the deque. However, reallocation may perform better than for vectors, because according to their typical internal structure, deques don't have to copy all elements on reallocation.
--------------------
thanks in advance,
George
|
|
|
|
|
Hi George,
reallocation to me means:
1. performing a new allocation (at a new address)
2. copying the existing data to it
3. returning the new address
It is used to change the size of some data structure (e.g. an array) without loosing its
content, typically when you want to add data but can't without all the steps involved,
since the existing allocation isn't large enough. Occasionally it is also used to reduce
size (when the original allocation was way too large, typically because requirements
initially unknown).
You could have a look at the realloc() function in C.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks Luc,
Cool! Question answered.
regards,
George
|
|
|
|
|
I used
Font *pFont=::new Font(L"Tahoma",12,FontStyleRegular,UnitPixel);
to create a Font object, when I do Graphics::DrawString using this font, the font is in bold style.
PS: I've Tahoma.ttf in the font directory.
|
|
|
|
|
You shouldn't necessarily be using the global namespace new operator for GDI+ objects.
If you use DEBUG_NEW and that's causing ambiguity with Gdiplus::new, you can get around it as shown below.
I tried this and it wasn't bold
#pragma push_macro("new")
#undef new
CClientDC clidc(this); <font color="Green">
Gdiplus::Font *pFont=new Gdiplus::Font(L"Tahoma", 12, FontStyleRegular, UnitPixel);
Graphics gr(clidc);
PointF origin(0.0f, 0.0f);
SolidBrush blackBrush(Color(255, 0, 0, 0));
gr.DrawString(L"abcdefghijklmnop", 16, pFont, origin, &blackBrush);
delete pFont;
#pragma pop_macro("new")
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I post in VC++ forum becoz I know they are the professionals. I might be having serious problem.
I was on IRC chat, I wanted to chat with a girl in a channel called "sex", she started giving me warnings that she doesn't want to chat with me.. I didn't go but I also didn't say any bad words, I wanted to talk with her. then she said to me that an email was sent to my ISP containing my ID and a copy of this chat, she told me that she is working with the government and she started giving me information like my ISP (I know you can get this from some programs), but she was talking very seriously and she told me that I am now guilty of harassment and soon I might be caught by the police.
do I seem stupid enough? maybe..
She was speaking so professionally about things like trace routing and alike, she did not seem to be joking and she was not a sex-girl searching for fun.
Questions:
1. Can IRC servers along with my ISP know my identity, I am behind a LAN that contains at least 200 computers.
2. How would they prove my identity? will they do it by tracing my MAC or IP address? does changing my ethernet card solve the problem? and what else should I do to hide my identity?
BTW: i have static IP address in my local network.
3. Are there any government agents that really work that way in chat rooms? heard of anything like that?
I am so annoyed now, I was searching for a girl and now she fu**ed me, I need answers from professionals.
|
|
|
|
|
sold_out wrote: I am behind a LAN that contains at least 200 computers
Make sure your attorney knows that
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Only in the extremely unlikely case where it goes that far.
I wouldn't be worried unless you sent improper material or show up at an
underage girl's door.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No, she told me that she is 25, and she told me that she is interested in sex in our first minute, but then she told me that I should go and I didn't.
Can they identify me by trace routing? this would be a disaster
EDIT: I told her that I want to see her on cam
|
|
|
|
|