|
Try this (non-unicode):
<br />
char * hex = "007A";<br />
int i;<br />
sscanf(hex, "%x", &i);<br />
<br />
OR<br />
<br />
CString csHex = "007A";<br />
int i;<br />
sscanf(csHex, "%x", &i);<br />
<br />
I now contains the numerical value of the hex-interpreted value 7A.
That is 122 (decimal).
Justify for Unicode as needed.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I am developing a application using vc++. I want to copy a folder
with its entire contains from one location to another location through
code. How can I achieve this using VC++ 6.0.
|
|
|
|
|
sujtha wrote: I am developing a application using vc++.
MFC?
Use the CopyFile function.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote:
Use the CopyFile function.
This operates on one file at a time, plus a call to CreateDirectory() would also need to be used.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
int SHFileOperation( LPSHFILEOPSTRUCT lpFileOp );
-----------
Mila
|
|
|
|
|
my suggestion is SHFileOperation
|
|
|
|
|
sujtha wrote: I am developing a application using vc++. I want to copy a folder
with its entire contains from one location to another location through
code. How can I achieve this using VC++ 6.0.
http://www.codeproject.com/shell/cshellfileop.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
Support CRY- Child Relief And You
|
|
|
|
|
I use these codes to storage the data
ofstream output(filename,ios::out|ios::binary);
if (!output)
{
cout<<"Khong mo duoc file"<<endl;
exit(1);
="" }
="" output.write((char="" *)="" &n,sizeof(int));
="" for="" (i="0;i<n;i++)
" {
="" cin="">>obj[i];
}
for (i=0;i<n;i++)
{
="" output.write((char="" *)="" &obj[i],sizeof(student));
="" }
="" output.close();
but="" i="" cant="" read="" the="" data="" with="" these="" code
="" ifstream="" input(filename,ios::in|ios::binary);
="" if="" (!input)
="" cout<<"khong="" mo="" duoc="" file"<<endl;
="" exit(1);
="" input.read((char="" &n,sizeof(int));
="" student="" *obj="new" student[n];
="" for="" (i="0;i<n;i++)
" while(input.read((char="" &obj[i],sizeof(student)))
="" cout<<obj[i];
="" cout<<"\n";
="" input.close();
please="" help="" me="" to="" figure="" it="" out
thanks=""
<div="" class="ForumSig">hehe
|
|
|
|
|
It'd help if you told us what the actual problem is
Does your code not compile (what's the error)
Does it crash when you run it (where?)
Have you tried stepping through with a debugger, to check what you're getting it what you'd expect?
|
|
|
|
|
Please wrap your code snippets with <pre> tags, and make sure the angle bracket in the for statement is correct. Otherwise, it makes for very illegible code. You would have noticed this had you clicked the Preview button.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
i'm really a beginner here, so hopefully somebody can help me. i'm
currently doing a dialog application for a IC tester(hardware). In this
application, it will send some vector(series of '1' and '0' ) to the IC
tester(hardware) and then after the testing it will return back a result
vector(series of '1' and '0' ) to the computer. Therefore, in the dialog,
it will hv a button to start the testing. Once the button is pressed, the
testing will begin and later in the dialog, it should display the input
vector and also the output vector( which looks like a square wave to
represent 1 or 0). The data for the vector can be taken from a file saved in text format.
The problem now are:
1)how do i display the vector in my dialog box? Should i create and list
box or picture to display the graph in the dialog?
2)is there anybody who knows how to draw a square wave by getting the
data from a file( the file contains a series of 1 and 0, and if 1, the
wave amplitude is high and if 0 it will show low). Which function do you
recommend me to use?
3) i also need to be able to zoom in/out to view the vector.
Thanks.
|
|
|
|
|
First, you have to separate properly everything: how the data is represented for example (in the file) has nothing to do with how it will be displayed on the screen and how it will be sent to your IC tester. So, basically, what you have is a list of 0 and 1 and you want to display them on the screen (and you have two separate lists).
Did you take a look at the link I gave you last time ? About the chart control I developed (see here[^] ) ? I think by tweaking it a little bit you will be able to achieve what you are looking for: have two traces displayed on the screen. Of course, you need to offset one of them (e.g., one is between 0 and 1 and the other is between 2 and 3) do that they don't overlap. But, you can simply hide the Y axis so that you won't see the values.
Of course, you can also do it yourself. But then, I would suggest to create a custom control (see articles on this website) and write all the code yourself (so you will need to draw everything yourself). Which can be quite long, specially if you are a beginer.
But, one thing that is really important (and that confuse a lot of beginers), is to separate things that are not related: the reading of the file must be separated from the way you display your data that must be separated by how you send your data to your IC...
|
|
|
|
|
Hi, I have a problem...
In my application there is a CEdit box and i put text in it, if I cancel this text the application return a Debug error...
There is some initialization that I must do?
Please help me
|
|
|
|
|
fabiotriolo wrote: if I cancel this text
What does 'cancel' mean ? What did you do ?
fabiotriolo wrote: the application return a Debug error...
What error exactly ?
|
|
|
|
|
Its not sufficient for answer
|
|
|
|
|
WhiteSky wrote: Its not sufficient for answer
humm Happy Eid Buddy!
"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
Support CRY- Child Relief And You
|
|
|
|
|
Im wondering we have two messages on same time
|
|
|
|
|
fabiotriolo wrote: if I cancel this text...
Which means what exactly.
If you have an edit control which must contain valid, non-empty data before the dialog can be dismissed, you should disable the OK button until such conditions exist.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I write text in my edit control...if I erase all text from the edit control, my application return this debug error:
DAMAGE: After Normal block(#97) at 0x003D2998
|
|
|
|
|
fabiotriolo wrote: I write text in my edit control...if I erase all text from the edit control, my application return this debug error:
could you show us your actual code?
"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
Support CRY- Child Relief And You
|
|
|
|
|
Can you show your code that has error
|
|
|
|
|
This is the code:
void CwpaguiDlg::OnEnChangeTextUtente()
{
//prendiamo il testo digitato
int len,i, nLineCount = utente.GetLineCount();
CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
utente.GetLine(i, strText.GetBuffer(len), len);
}
strText.ReleaseBuffer(len);
strLine.Format(TEXT("\"%s\""),strText);
|
|
|
|
|
fabiotriolo wrote: CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
utente.GetLine(i, strText.GetBuffer(len), len);
}
strText.ReleaseBuffer(len);
strLine.Format(TEXT("\"%s\""),strText);
you getting buffer many times but releasing only once.. that is cause of Crashing of you application...
code something like this to avoid crash
void CwpaguiDlg::OnEnChangeTextUtente()
{
//prendiamo il testo digitato
int len,i;
int nLineCount = utente.GetLineCount();
CString strText, strLine, str1Text;
for (i=0;i < nLineCount;i++)
{
len = utente.LineLength(utente.LineIndex(i));
LPTSTR pString = strText.GetBuffer(len );
utente.GetLine(i,pString , len);
strText.ReleaseBuffer();
strLine+=CString(_T("\n")+strText;
}
}
"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
Support CRY- Child Relief And You
|
|
|
|
|
Hi,
Sorry to have started a new thread for an old problem.But there was no reply for a long time so I thought I should restart.
If this a problem I won't do it again.
int *pValue = new int;GetParent->SendMessage(MY_MESSAGE, 0, (LPARAM) pValue);
delete pValue;
In the handler function for MY_MESSAGE:
LRESULT MyParent::OnMyMessage( WPARAM wParam, LPARAM lParam )
{
*(int *) lParam = 123; return 0;
}
The above code was given to sent a message to the parent window and allocate memory for a variable which belongs to the parent.
Thanks for the above code.It was really useful
But can I make Message map of the form MY_MESSAGE and have a handler function OnMyMessage ?
Since message maps are something that are provided by Windows API and they can be generated through Class Wizard where messages and their corresponding functions are already given. Ex WM_KEYDOWN with function OnKeyDown()
Prithaa
|
|
|
|