|
Hi All,
I am writing an application and need to save some data with an incremental number.
My first thought was to use an integer that be could incremented and shoved out disk, now I am trying to do thing properly so I have come up with the following
String Path = Directory.GetCurrentDirectory();
string[] file_text = Directory.GetFiles(@Path, "*.txt");
string Name;
int FileTotal = 0;
for (int i = 0; i <= file_text.Length - 1; i++)
{
Name = file_text[i].Substring(Path.Length+1);
FileTotal++;
}
MessageBox.Show(FileTotal.ToString());
FileTotal++;
MessageBox.Show("Next File to Written is " + FileTotal.ToString());
It looks for the file (in the bit of example code .txt ...) adds one to the total for the next one. Is this the 'correct' way of doing things or am I creating a kludge that will come back and bite me later.
Glenn
|
|
|
|
|
What you are trying to do is unclear; please explain more clearly.
glennPattonWork wrote: Is this the 'correct' way of doing things or am I creating a kludge that will
come back and bite me later.
It might be OK, but I can't say for sure until I know what you are trying to accomplish.
Is there a database involved?
|
|
|
|
|
Hi,
Sorry about that I had not really had chance to proof read it when it got posted (mix of Web connection and finger trouble) What I am aiming to do is to create a load data files
such as Data001.msg, Data002.msg etc at the moment I have it updating a variable that goes to an ini file (I know, I am under orders to make an .ini, you bring up XML but no! separate story)I want the program to look at the location say there are six file with an .msg extension I would like the variable to be seven and create Data007.msg and on. I was trying to find a way to do this that wasn't too bad. Sorry, there is no database involved at this stage!
Glenn
|
|
|
|
|
glennPattonWork wrote: say there are six file ... I would like the variable to be seven
Well, then what about int FileTotal = file_text.Length ; ?
|
|
|
|
|
Thanks for that, I still wonder if I would better suited to something other than Windows programming!
|
|
|
|
|
|
Hmmm, LINQ never messed with it, I have a look....
|
|
|
|
|
|
Thanks for that when I have the time I will take a look at using LINQ, PIEBALDconsult's method works for what I am trying to do, can you recommend any sources for LINQ ?
|
|
|
|
|
|
I had found the MSDN stuff, so it looks like I have been LINQ'ing for a time with out realizing it....
|
|
|
|
|
|
|
There are obviously fairly serious synchronisation issues here, if there is any chance you could have two threads or two applications running at the same time. You probably realise that but just making sure!
|
|
|
|
|
As far as I am aware at the moment I have only one thread on the go! Thanks for the heads up though!
|
|
|
|
|
is it possible to make ping to another computer in windows-mobile
using C# code ?
thanks
|
|
|
|
|
Please don't crosspost. Pick one forum and stick with it.
|
|
|
|
|
I m new in this C# language so i find problem in talking sound input from mic.
I don't know how to use API and want to solve this problem without using API
|
|
|
|
|
|
Is there any other way which can someone send post or get values with C# to PHP and previewing them with PHP in internet explorer??
An 100% solution is to use ProcessStartInfo( "my link&value = ","my data");
And when i'll do a echo $_GET['value'] it returns my data just fine. But the problem is that i have to do with million or billion values.
If i put on and EventHandler which reads from serialport,
Then IE or other browser will opens me million or billion tabs!!! What should i do for this way or propose me something else please???
Thanks
All the truth becomes from knowledge...
|
|
|
|
|
Why don't you collate all this data together and show all of this in a single tab by just sending one echo value.
|
|
|
|
|
I'm reading my data from a device. So i want these values to preview in a website realtime too in a PHP website.
How to do something like that?
Thanks
All the truth becomes from knowledge...
|
|
|
|
|
Why do you want to use a browser for this? What you want to do most of the time is update a value – a web page is not the ideal medium for that. Just use a form with some labels or a table or however you want to visualise the data, and update it whenever you get a new value.
|
|
|
|
|
They want to do something like that. They want to display my data both C# and IE php website realtime too.
All the truth becomes from knowledge...
|
|
|
|
|
Push the data into a database or something else that the website can look at, and have the website auto-refresh its data sections via an AJAX callback.
|
|
|
|