|
Thanks for your answer
Do you know how would it look like ? I went through several forums for byte[] or buffers but it is not very clear as I am recent to c#
Thanks anyway !
|
|
|
|
|
Google "c# copy file via streams". There are lots of samples...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Ok thanks
But in a code like this; I can't seem to see where to set the file names like "@c:\test.txt" for example :
public static void CopyStream(Stream input, Stream output)
{
int bufferSize = 4096;
byte[] buffer = new byte[bufferSize];
while (true)
{
int read = input.Read(buffer, 0, buffer.Length);
if (read <= 0)
{
return;
}
output.Write(buffer, 0, read);
}
|
|
|
|
|
Samarchpa wrote: But in a code like this; I can't seem to see where to set the file names like "@c:\test.txt" for example :
It holds inside Stream object.
I Would use StreamReader And StreamWriter
|
|
|
|
|
File.OpenRead(filename) , for example, yields a Stream as the return value
So you could call
CopyStream(File.OpenRead("C:\\input.txt"), File.OpenWrite(C:\\output.txt"));
|
|
|
|
|
Do we really have to hold your hand through the entire process? Be a programmer for god's sake...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Do we really have to hold your hand through the entire process? Be a programmer for god's sake...
That is for me the purpose of a forum: get some help !! when you are new to a domain and have been searching on the net for hours, the forum comes to be a good solution. Do you really think I did not use google, msdn or else before requesting some help ?
Thanks for those who took the time to answer. I am now searching how to get the total buffer size on the outstream in a variable. If anyone has an idea...
|
|
|
|
|
Hi,
A modern PC should copy from tens to a few hundreds of MB per second.
Copying files with a buffer size that small (4KB) and/or updating progress information all the time, would probably make it much slower (10 or more times slower).
IMO you should use a buffer size that equals a power of 2, and no less than 64KB; I would prefer 256KB or 1MB.
And it does not make sense to update a progress report more often than a few times per second.
If you need to copy several files, then I wouldn't bother copying them with buffers, I would just use File.Copy(). You can calculate progress by summing all the sizes initially, then advance a "done" value by the size of each file copied. A timer (best a System.Windows.Forms.Timer) would suffice to periodically update the progress report.
|
|
|
|
|
I use axShockwaveFlash COM in the my frmSplash windows form for play flash file. I want to ShowDialog frmSplash in my main form. Its properly work. But I use thread I get error, Cannot create axShockwaveFlash component instance.
In my main form contain following code;
private void button1_Click(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
Thread thread = new Thread(DoSplash);
thread.IsBackground = true;
thread.Start();
}
private void DoSplash()
{
frmSplash sp = new frmSplash();
sp.Show();
}
My frmSplash form just contain axShockwaveFlash component. I dont write any code in this form.
How can I solve my problem, thanks...
|
|
|
|
|
Hi,
I have no experience with flash controls, however Control.CheckForIllegalCrossThreadCalls = false; is a mistake. You may want to read this[^] and reorganize your code.
I trust Google could point you to some articles that do it successfully, maybe even at CodeProject!
|
|
|
|
|
On top of what Luc said, you cannot create forms on background threads and expect them to work. They must be created on the UI thread (startup thread) and well as any controls on those forms. Creating UI components on background threads is unreliable and cannot be trusted to work 100% the time.
|
|
|
|
|
Does anyone know of a CAD library for C# / .NET?
Failing that, is there a basic interface library that handles multiple pages in a similar way to Word?
TIA!
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
|
|
|
|
|
|
Which software I use for running C# program...
I m starter...
My question is when I was learning C I use turbo C
now for C# ....
Microsoft C# 2008 expressions
|
|
|
|
|
for C#, VB.NET, managed C++(Old Name C++/CLI), ASP.NET uses .NET Franework.
code_breaker wrote: My question is when I was learning C I use turbo C
So let me get it: You are asking witch IDE (Integrated Development Enviroment) do you need to start programming?
SharpDevelop is open Source
|
|
|
|
|
Please ask a question, also the hiaku form, whilst poetic, isn't easy to read.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
code_breaker wrote: Microsoft C# 2008 expressions
?? MS Visual Studio C# Express Edition 2008
|
|
|
|
|
Microsoft C# Express Edition is free, and you can sell software you create with it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
for beginning how to develop applications using c#,u should first of all install visual studio as your development environment.then i suggest u to watch c# tutorial videos and read articles(including this site) which can help u start building applications.visual studio express edition is free,although u can find the full version and download it through torrent files.good luck my friend.
don't forget to choose best answer!
|
|
|
|
|
Hello,
If any one can guide me plz.
Is it possible to obtain multimedia projector resolution using a c# code? if yes, then kindly tell me how to do it.
Thanks.
|
|
|
|
|
Hello,
I m a student of CS and i m doing a project on hand gesture recognition. I don't have much know how about Digital Image Processing.
I shall be very greatfull if someone can help me out. I want to first segment the hand and then follw its path and gestures but first thing is how can i identify the hand and then use it for future comparisons.
thanking you in anticipation 
|
|
|
|
|
Erm....
That sort of thing is difficult, very difficult, and highly specialised (ie it's the sort of thing that university research departments specialise in). Recognising a hand in a video/picture with any egree of reliability alone is fairly difficult.
I suggest you research this topic before posting here, as this forum tends to be more along the line of "I'm trying to acheive x, here is my code, why am I getting error y". Hopefully someone here will be able to point you to some research materials, however.
Good luck!
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
I have some strange problem here, so i was wondering if i could solve it in this way (i know it's not the best way to solve a problem, but i want a quick and dirty solution at the moment)
Let's say i have a button, with the focus on it. When i press the button a messagebox is shown. I only want the messagebox to be shown when i press the button with my mouse.
When i press enter i don't want the messagebox to be shown.
So i tried handling the keypress method and set the eventargs e.handled=true. But no effect, it doesn't even get inside the keypress method when pressing enter...
I know it's a strange question, but anyone have any ideas?
Thanks in advance.
|
|
|
|
|
wow this must be the dumbest question i've ever asked here...
I could just use the mouseclick event, problem solved 
|
|
|
|
|
Hello!
I am quite new to programming. I have no ideea how to cancel these 'automatic' key events that rise from hiting 'enter' or 'space' on a button but here is how i would do it:
Set button's 'TabStop' to false. Create an 'enter' event and put this inside the event:
SelectNextControl(yourbuttoncontrolhere, true, true, true, true);
This won't allow the user to focus the control in any way but it will allow him to click the button.
Hope this helps,
Good luck!
|
|
|
|