|
The ItemData is just a DWORD associated with each item. The combo box doesn't use it in anyway, so it's up to you to clean up any memory you allocate.
You could loop through all your items and delete the pointers, then call ResetContent.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
|
Hi all,
I'm trying convert "D:\Documents\delay.txt" to "D:\\Documents\\delay.txt". Anybody can help me?
Thank so much!
|
|
|
|
|
Why? Escaping is handled at compile time, not runtime.
But, depending on your platform, most of the string classes have a replace function.
MFC:
CString string1("D:\\Documents\\delay.txt");
string1.Replace("\\", "\\\\");
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
char *strFilePath = new char[1024];
strFilePath = "D:\Documents\delay.txt";
So, how to replay('\','\\'). I'm used C language.
|
|
|
|
|
Try:
strcpy(strFilePath, "D:\\Documents\\delay.txt");
You need the double backslashes \\ in your string literal, because \ is the escape character, so the compiler is translating what you wrote as \D and \d. Lookup "C escape sequences" on google.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
Hi you can use strchr method in recursive order which will give u the "\" location. you have to just replace it as "\\"
I think this is what looking for.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
the good question is "why do you need to do this ?"...
I suspect a dark reason which is in fact because you're trying to hack something because you don't actually understand that string escaping is useful only in your source code...
if you're getting the string from an external source (input, textbox, open file dialog), the string you get is already good.
you need to escape \ into \\ only in your source code, because if you don't, the \ character will try to escape the character next to it, and that's not what you want. you want a single \ in the string, because it is the folder separator character, which must be typed '\\'...
|
|
|
|
|
Hi all,
i got question here need some information. i'm new in in programming.
could anyone help.
#include <stdio.h> <br />
int main()<br />
{<br />
int a,b,c:<br />
a=5;<br />
b=7;<br />
c=a+b;<br />
printf("%d+%d=%d\n",c,a,b);<br />
return 0;<br />
}</stdio.h>
Can, anyone help me go through with this. Thanks. in my mind, the answer display on the screen should be "12+5=17". i'm not sure is that correct. if not correct, can you please explain. Thanks all.
|
|
|
|
|
int a, b, c; <-- not ":", but ";"
the result is : 12+5=7
|
|
|
|
|
How about this? Do i do it correctly,
unsigned int a,b,c;
void main()
{
a=10;
b=7;
c=a>>5;
b=c|a;
a=~c&~b;
c=b*a^5;
}
end
I know >> is greater than. * is square and ^ xor.
The command like "|" and "~" i really not familiar with. Can anyone explain or go through with it. What it will be the final value for a, b and c? I really confused
|
|
|
|
|
Member 4099222 wrote: I know >> is greater than.
No, that's for shifting bits.
Member 4099222 wrote: * is square...
No, that's for multiplying.
Member 4099222 wrote: The command like "|"...
That is logical OR.
Member 4099222 wrote: and "~" i really not familiar with.
That is one's complement.
Member 4099222 wrote: What it will be the final value for a, b and c?
Why don't you try it and see?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Refer to your replied,
unsigned int a,b,c;
void main()
{
a=10;
b=7;
c=a>>5;
b=c|a;
a=~c&~b;
c=b*a^5;
}
end
The result i got for c=a>>5 is 0.3125 (because 10 divide with 32). So how do i proceed with b for 'or' operation and how to calculate the value of a? thanks
|
|
|
|
|
Member 4099222 wrote: So how do i proceed with b for 'or' operation...
The variable b will be assigned a value of 1 because either c or a will have a non-zero value.
Member 4099222 wrote: ...how to calculate the value of a?
I guess that would depend on what value you want it to have.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
unsigned int a,b,c;
void main()
{ a=10;
b=7;
c=a>>5;
b=c|a;
a=~c&~b;
c=b*a^5;
}
end
this is how is work on,
c=a>>5 ; //so c=10/32=0.3125
b=c|a; // so b=0.3125|10 = 1 (this one i'm not sure it right)
a=~c&~b; // so ~c= -0.3125 and ~b= 0. so ~c&~b=0 (& is AND operator)
c=b*a^5; // so b=1 and a^5=5 (^ is XOR operator)
so the final value for a,b and c
a=0 b=1 and c=5.
Please confirm that my work is right. Thanks for your help.
cheers
|
|
|
|
|
Member 4099222 wrote: Please confirm that my work is right.
Why? Can't you just print those values out to confirm?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
printf("%d+%d=%d\n",c,a,b);
c is your total and is in the wrong position.
b = 7 not 12 and is in the wrong position.
a is okay.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
How about this? Do i do it correctly,
unsigned int a,b,c;
void main()
{
a=10;
b=7;
c=a>>5;
b=c|a;
a=~c&~b;
c=b*a^5;
}
end
I know >> is greater than. * is square and ^ xor.
The command like "|" and "~" i really not familiar with. Can anyone explain or go through with it. What it will be the final value for a, b and c? I really confused
|
|
|
|
|
Member 4099222 wrote: c=a>>5;b=c|a; a=~c&~b; c=b*a^5;
WTF are you trying to achieve with this ?
why don't you just listen to the answers you get, try to understand them, and fix your code the simple way people just told you ?
your parameters to printf() are in the wrong order dude !
your code is making the addition of c = a + b , but you want to print c + b = a ... WTF !
what you do (the wrong thing):
printf("%d+%d=%d\n", c, a, b);
what you should do (the good thing):
printf("%d+%d=%d\n", <code>a, b, c</code>);
|
|
|
|
|
Hi,
I wanted to save HDC into a file(*.jpg). How can I do this?
I will appreciate your reply.
Thanks.
|
|
|
|
|
I'm quite new in this stuff and wonder how can I send a file to an eMail address ...
Maybe It's a funny question, but I should go ahead!
Thank you masters!
|
|
|
|
|
|
Hi masters!
--------------
Whenever I try to find drive types and their letters using GetDriveType(), FindFirstVolume() and also FindNextVolume(), I get an odd string like this:
//?/a12c-abb14d-acbb0252-dda525/
as the name of founded drives ...
How can I find drive types and letters (Something like: D:\, C:\, ...) on a given system?
Thank you masters!
modified on Tuesday, September 23, 2008 4:00 PM
|
|
|
|
|
To list the available volumes, use GetLogicalDriveStrings()[^]. Then, for each drive path returned, then use GetDriveType().
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
Thank you so much
Thank you masters!
|
|
|
|