|
Hmm...Name worked for me.
Glad you got it working!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
C++ finally has a "for each" statement, and I still never remember to use it.
Maybe typing it out here will help me remember
Here's a modified version...
<font>using namespace System::IO;
...
String ^SourcePath = "C:\\SourceFolder";
String ^DestinationPath = "C:\\DestFolder";
DirectoryInfo ^directory = gcnew DirectoryInfo(SourcePath);
array<FileInfo^> ^files = directory->GetFiles("x*.txt", SearchOption::AllDirectories);
for each (FileInfo ^fileinfo in files)
{
File::Copy(Path::Combine(SourcePath, fileinfo->Name),
Path::Combine(DestinationPath, fileinfo->Name));
}</font> Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Nice, thanks for help, I have just bought some books: vc++.net, Vc++2005,
Vc++2005 examples, c++ in 24 hours, programming with c++ and art of assembly, I have a lot to learn
|
|
|
|
|
Houston, I have a problem!
I'm trying to convert a decimal number (31 digits)
9876543210987654321098765432101
to binary form. Problem is I can't store the decimal as an integer, because it won't fit. It's too large!
Any ideas how I can get started?
I know how to convert a decimal to bin, but one of this size...??
I'm writing this as a c-program.
Thank you!
Over and out...
|
|
|
|
|
All it takes to convert an integer number to binary is testing for odd/even, dividing by 2,
and testing for zero; so how would the size of things matter?
You normally get the lowest bit first, so each new bit needs to be prefixed to whatever
you already have. That should be no problem.
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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 for your reply Luc!
I know how to convert an integer to binary (dividing by 2). But I can't find a way to divide the number: 9876543210987654321098765432101 by 2? The decimal is way too big to store in an integer!
|
|
|
|
|
How are you holding the large decimal?
- in a string? then devise a function to divide a string by 2, resulting in a new string;
the algorithm should mimic how you do it by hand (that would be left-to-right!).
- in a special type? if so, that type should know how to perform the standard operations.
Some languages, such as C#, have a Decimal type; and there are "big integer" or "multi-precision"
packages that offer the same functionality. Chances are they also know how to show a number
in binary...
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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
|
|
|
|
|
I store it in a character array, and I'm using Borland Builder. I'm not really sure how to make a division of an array? And taking one number at the time wont work, I got to calculate on the whole decimal to get the correct answer.
|
|
|
|
|
if you divide by hand, you do it one digit at a time, holding a carry digit
example: if no carry, half of 6 is 3 and new carry is 0; half of 7 is 3 and new carry is 1;
if carry, half of 7 is 8 and new carry is 1
you can do the same with your array of chars.
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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
|
|
|
|
|
But if you have a larger number with 31 digits you can't do like that! Even if you have only two digits it it's not possible. 10/2 = 5 is not the same as 1/2 + 0/2! Then imagine having 31 digits!?
|
|
|
|
|
Do you know how to do it by hand, without a calculator, without a computer?
If so, you can do exactly the same thing by software.
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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
|
|
|
|
|
Yes I do, and that is not the reason why I wanted help here! How do I make a division with a 31 digit who is way too fat to be stored in an integer? That's what I want to know! Of course it's possible.. I just don't know how to get started?!?!
|
|
|
|
|
smsmfe wrote: Yes I do
smsmfe wrote: I just don't know how to get started?!?!
Set carry and quotitent to zero
remove the leftmost digit
divide it by two, taking into account the carry
note down the resulting quotient digit and update the carry
repeat till done
that's what you know but don't know, isn't it?
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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,
Luc Pattyn wrote: divide it by two
Here's the problem. I can't make that division! I'm not sure we understand each other...
Can't you make a simple c-program taking a 31 digit number and divide it by 2? Cause I still don't see how to make a division with such a large number. Sure, I can store it in a byte-array or whatever, but somehow I need to treat the 31-digit as a single unit and not as an array and there simply is no datatype large enough available...
|
|
|
|
|
I have explained to you over and over how to divide an arbitrary length number by two,
assuming the number is stored in a char array.
Now you don't want it in a char array?
How do you want it stored?
What will happen to it next?
What is all this about?
How many more posts do you need to state the problem?
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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
|
|
|
|
|
You have not explained anything to me that I didn't already know. I have asked a thousand times how to make the division with a number too large to be stored as a single number (int). If you really know how to do it, why don't you show me in code?
I have a 31 digit, currently stored in a character array. You told me to make a function that divides a string by 2. Try to do that and maybe you will realize what the problem is. It's no problem taking a value like 10 and divide it by 2. But a number like 9876543210987654321098765432101 you simply can't divide by 2 in the same way! My problem is that the number needs to be stored in another way than a small number like '100'. Like I said, I got it stored in a character array. But how to make a division on a character array which is a bunch of boxes of single numbers and not a complete number of 31 digits? In theory I know exactly how to make the division, don't bother explain that to me, just show me how to make a division of a character array!
/Martin
-- modified at 3:04 Tuesday 27th November, 2007
|
|
|
|
|
Dear,
How can I use chart object to display statistic data?!
I add reference MS Chart20Lib 2.0 and interop OWC11.1.0
but no components add in tool box.
how can I do it? Who can send me a example code?!
thx.
|
|
|
|
|
Have you looked around on msdn?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
how can I transfer integer Dec to hex
I want to show hex kind in monitor.
like 112 -> 0x70
use sprintf?!
sprintf(str, "%x", data);
textBox1->Text=str;
醬子嗎??!!
|
|
|
|
|
I use this code to do it.
richTextBox1->Text += Conversion::Hex(m_Buffer[j])+" ";
|
|
|
|
|
Hi all,
OK, desperate now - I've been on this for days...
I have a large native C++ mobile project I have just migrated from eVC++ to Visual Studio 2005.
I need to integrate Intermec's RFID library into the project but they only have a managed .NET assembly available.
Is there some way I can 'talk' to this code? Can I create a C# project, incorporate the Intermec stuff, create some entry points and access them, dll style?
I was thinking of migrating my project to managed C++ but it seems this is not available in the Compact Framework.
Any suggestions would be much appreciated.
Regards
Jason
|
|
|
|
|
do you have clr enabled?
If yes, gcroot is you friend. It will allow you to point to a c# dll that you can add to you project.
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
I want do create a modeless (non-modal) Dialog. I have tryed this with ShowDailog(), but this ist modal.
How can I create a modeless Dialog?
|
|
|
|
|
use Show() instead of ShowDialog().
Luc Pattyn [Forum Guidelines] [My Articles]
this months 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
|
|
|
|
|
Yes I know!
The Problem is that the modeless Dailog gets no resources, when the parent dialog is still working:
When I make the following code on the parent dialog, with an endless loop I can not use the modeless dailog. All resources are on the parent dialog
void OnClick()
{
CDia dia*=new CDia();
dia->Show();
do{
// Do some Code
}while(1);
}
|
|
|
|