|
return sscanf (test, "%s %i %s", name, id, password) != 0;
You haven't got the standard library memorized? sscanf() returns the number of matches (hopefully 3 in this case) or EOF, not true or false. So although this is the right idea it should probably be an == 3.
(and the %i should be a %d)
David's strtok() suggestion is the way to go in my opinion as it gives you the opportunity to validate the data.
|
|
|
|
|
Hi,
Using a structure will be good. Thts what i feel.
|
|
|
|
|
If there is a unique identifier on each side of the ID, you can read each line of the file, and split it into its (three) parts using strtok() . Although not recommended, you can also use fscanf() to parse each line.
"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
|
|
|
|
|
You know,the API function GetVolumeInformation()would get a serial number of a device.
But the number is variable,and is not be writen by the productor,so it can be writen again and again.
I want to encrypt some files using the devices firmware serial number.
Some one would like to tell me how to get such information?
Thanks.
GOOD LUCK.
|
|
|
|
|
look at the documentation of the design specifications,
if there is no api, the firmware development team should encode
a firmware function program to pass the handle higher layer
|
|
|
|
|
I'm an ugly guy, have't used CImageList before.
I've viewed some code use CImageList like this.
First declare class members:
CImageList m_imlListCtrl;
CListCtrl m_list;
then
BOOL CMyDlg::OnInitDialog()
{
CImageList imlStack;
imlStack.Create(code);
imlStack.Add(theApp.LoadIcon(IDI_A));
imlStack.Add(theApp.LoadIcon(IDI_B));
m_list.SetImageList(&imlStack);
m_imlListCtrl.DeleteImageList();
m_imlListCtrl.Attach(imlStack.Detach());
}
why not
m_imlListCtrl.DeleteImageList();
m_imlListCtrl.Attach(imlStack.Detach());
m_list.SetImageList(&m_imlListCtrl);
DO TELL ME. or give me some article guides.
|
|
|
|
|
Why not like this.
m_imlListCtrl.DeleteImageList(); <br />
m_imlListCtrl.Create(code); <br />
m_imlListCtrl.Add(theApp.LoadIcon(IDI_A)); <br />
m_imlListCtrl.Add(theApp.LoadIcon(IDI_B));<br />
m_list.SetImageList(&m_imlListCtrl);
The second method you proposed is also ok. but why are you creating a local CImageList object CImageList imlStack; ?
|
|
|
|
|
Except icon you can add your bitmap.
CBitmap bmp;
bmp.LoadBitmap(IDB_MYBITMAP);
pmyImageList->Add(&bmp, RGB(0, 0, 0));
|
|
|
|
|
TO Naveen.R
I'm not familar to CImageList at all.
The code I posted is the source code in EMULE. I'm curious too why use the stack imagelist to set the imagelist of the CListCtrl, while not like your codes.
TO Hamid.
Can load 2 bitmaps like this:
<br />
CBitmap bmp;<br />
bmp.LoadBitmap(IDB_MYBITMAP);<br />
m_iml.Add(&bmp, RGB(0, 0, 0));<br />
<br />
bmp.LoadBitmap(IDB_MYBITMAP2);<br />
m_iml.Add(&bmp, RGB(0, 0, 0));<br />
|
|
|
|
|
But why two bitmaps you can use more files anyway I think my answer was incorrect you use of Bold for font.;P
|
|
|
|
|
|
purplee85 wrote: how i could get gdiplus.h header file?
Download the latest platform SDK.
|
|
|
|
|
|
purplee85 wrote: Subject:Re: [Message Deleted]
Sender:purplee85
Please never delete your message.. it could be helpful for other!
"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
|
|
|
|
|
Now I have a question of you why you delete your message?
|
|
|
|
|
Hi All,
I am using VC++ win32 application in VS 2005.I have created one project as win32 and now I want to add one another project which is omnithread into same solution.I want to make it as static library.
How can I use omnithread.h,nt.h and nt.cpp files in this project.And what my project settings I have to change?Please suggest me.I tried this by reading the Readme.Win32 but I did not get success.
Can anyone test the application making new project with including other project as omnithread and use this project's classes into the ohter project in the same solution. You can download these files from the below link.
http://www.koders.com/cpp/fidB630376C86E504519D0CBF450C0AA4358CFC3915.aspx?s=omnithread.h[^]
If you get any idea or any suggetion then reply me.
Thanks in Advace.
Ashish Bhatt
|
|
|
|
|
Hmmm, where to start.
Simple answer:
#include "omnithread.h"
And add nt.cpp to your project.
Longer answer:
If you're struggling to include a header, then threads may be overly ambitious.
Bit Longer answer:
Is there a reason you're not asking on www.koders.com where the files are from? I know that *I'm* not going to make a dummy project, download those files, work out what they're about, test it, then tell you. That's the sort of thing you PAY people for.
Iain.
|
|
|
|
|
hai,
in which forum did you actually want to post this.
|
|
|
|
|
|
hai all.
that was her question.
|
|
|
|
|
So her question was a general question.;)
|
|
|
|
|
Hi all,
Anybody know, please, how i can concatenate CString with hex values?
<br />
CString message = _T("Hello");<br />
unsigned char HexPrepend[] = { 0x01, 0x02, 0x03, 0x4 };<br />
So in memory result should be:
<br />
0102030448656C6C6F<br />
Regards,
L.
|
|
|
|
|
you can use the %x to put it in the CString variable. Ex. message.Format("%x",HexPrepend[0])
|
|
|
|
|
Larrson12 wrote: So in memory result should be:
0102030448656C6C6F
thats fine,
but what memory are you referring to here.
if it is the CStrings memory, based on what Llasus has suggested, here is the clearer version.
message.Format("%02x%02x%02x%02x%s",HexPrepend[0],HexPrepend[1],HexPrepend[2],HexPrepend[3],mesage);
is that what you are exactly looking for?
Gud Luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
if you change the unsigned char to simply char, the below mehod will be easy.
CString message = _T("Hello");<br />
unsigned char HexPrepend[] = { 0x01, 0x02, 0x03, 0x4 };<br />
CString csNewMsg( HexPrepend, 4 );
csNewMsg += message;
or
CString message = _T("Hello");<br />
unsigned char HexPrepend[] = { 0x01, 0x02, 0x03, 0x4 };<br />
TCHAR tcMsg[100];<br />
memcpy( tcMsg, HexPrepend, 4 );<br />
memcpy( tcMsg + 4, message.operator LPCTSTR(), 5 );
|
|
|
|