|
That looks like File.Copy("c:\\Vicky\\DATAS\\matrix.txt", "c:\\Vicky\\DATAS\\copy.txt");
Anyway, you're closing the first stream twice. Remove sr.Close();
|
|
|
|
|
|
what is the format of the file?
|
|
|
|
|
.txt format..with full of image intensity values from 0 to 16000
" Ella Pugalum iraivan oruvanukkae-A R Rahman "
|
|
|
|
|
Ok, that's not helping though, what is the actual format?
Something like:
(({decimal string}; )+{newline})*
what does it look like
Seriously, this could be important.. Last modified: 49mins after originally posted --
|
|
|
|
|
You need to close your StreamWriter:
fs.Close();
sr.Close();
fs1.Close();
to:
fs.Close();
sr.Close();
sw.Close();
fs1.Close();
|
|
|
|
|
thanks man....i got it....
" Ella Pugalum iraivan oruvanukkae-A R Rahman "
|
|
|
|
|
Try this.
private void button1_Click(object sender, EventArgs e)
{
try
{
string path = "c:\\Vicky\\DATAS\\matrix.txt";
string path2 = "c:\\Vicky\\DATAS\\copy.txt";
using (StreamReader sr = new StreamReader(path))
using (StreamWriter sw = new StreamWriter(path2))
{
string line;
while ((line = sr.ReadLine()) != null)
{
sw.WriteLine(line);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
You don't need to close the files/streams because using will do it for you.
Even if there is an exception.
I suggest setting a breakpoint on the while and stepping through the loop a few times.
Regards
David R
|
|
|
|
|
Hi,
I can't see any obvious mistake in the code, so you should look for clues.
1) Does the input file contain the expected data
2) Do you get an output file. If yes is it empty
3) Does the output file timestamp get updated
4) Trace the code using the debugger and determine if the string variable 'line' contains the expected data from the input file.
Once you have done all of that come back to us and tell us what you have found.
Alan.
|
|
|
|
|
A general method for file copying, based on what you have, would look something like this:
bool FileCopy(string path1, string path2)
{
try
{
using (FileStream readFileStream = new FileStream(path1, FileMode.Open, FileAccess.Read))
{
using (StreamReader streamReader = new StreamReader(readFileStream))
{
using (FileStream writeFileStream = new FileStream(path2, FileMode.Create, FileAccess.Write))
{
using (StreamWriter streamWriter = new StreamWriter(writeFileStream))
{
string line;
while ((line = streamReader.ReadLine()) != null)
{
streamWriter.WriteLine(line);
}
}
}
}
}
return true;
}
catch
{
return false;
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi all
How to use streamreader class to read all occurances of a specific tag out of an HTML file
Example i want to read this tag << p >> onwards
This is some text in a paragraph.
How do i able to capture p ?
Thank You
|
|
|
|
|
Easy way is to read each character and check it is the expected one. If yes, start reading from there. Other way is to read the whole file and use regular expression to find <p>.
|
|
|
|
|
How to type out the code?
=X
Thank You
|
|
|
|
|
What you mean?
|
|
|
|
|
U say
Easy way is to read each character and check it is the expected one. If yes, start reading from there. Other way is to read the whole file and use regular expression to find
So what is the coding to check if it is the expected one?
Thank You
|
|
|
|
|
You are highly unlikely to get a full code snippet. However, the regular expression you could try is along the lines of:
[<p>.*?</p>]{1,}
I'm a little rusty on regexs, so this may have unexplained behaviour
|
|
|
|
|
Hi,
need some help with application which should work like that:
when you turn on computer you see windows login screen, to the computer is connected smartcard reader, when you put the card it checks it. When it is ok windows login on a specific user.
or alternative version:
you login as a user, application in c# opens adn blocks mouse and keybord (fullscreen application i think. It asks user for a smart card and after checking it it unblocks computer.
if anybody have an idea how to make it (some code examples, maybe articles) I would really appriciate it
|
|
|
|
|
If Windows security isn't enough, you should probably only protect the particular applications you write.
|
|
|
|
|
this isn't about windows security.
on the smartcard is written student information and this is a way to check if student is present, save info about him etc.
and the side effect is that the application should block student account (in some way) to prevent using it without putting in the smartcard
|
|
|
|
|
How about a thumbprint thingy then?
|
|
|
|
|
You may want to look into a smart card framework like this. After that, it's a simple google search to figure out how to block the mouse and keyboard - perhaps you could achieve this by using the SwitchDesktop API call, since IIRC this is the way that the Lock Computer functionality works.
Another option; if you wanted to, couldn't you just call the LockWindow API function - it won't lock the keyboard and mouse, but that might (not certain) have smart card reader functionality built in, depending on which version of MSGINA you have
Just a few ideas to get you started
|
|
|
|
|
orescik wrote: when you turn on computer you see windows login screen, to the computer is connected smartcard reader, when you put the card it checks it. When it is ok windows login on a specific user.
I recommend first you read and understand Winlogon and GINA[^]. The only way you can do what you want is replacing some of the Winlogon functionality. You many want to think hard if you really want this. It is doable but not easy task.
orescik wrote: or alternative version:
you login as a user, application in c# opens adn blocks mouse and keybord (fullscreen application i think. It asks user for a smart card and after checking it it unblocks computer.
This seems better choice than the first one. But Windows is preemptive OS. Are you sure you want to take full control just to block the user?
Instead, what I would do is, when your application starts, the first thing you want to do is check for smart card presence, then read whatever you want to read and validate your input. When every thing is ok, allow the application to run, otherwise exit the application gracefully. This way you are confined to your application, your application become portable and you don't have to replace Windows functionality.
Here this may help you get started with smart card APIs[^]
just my 2 cents
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hallo everybody,
is there any class, library or DLL to clone a partition into another with C# ?
|
|
|
|
|
is this [^] what you looking for?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
no, i am talking of partitions in hard disks.
Though the name is the same, the topic you pointed me to regards OLAP and BI with SSAS, a totally different matter.
thanks anyway.
|
|
|
|