|
I have to change my mind... Always thinking about memory saving...
Thankyou ;o)
|
|
|
|
|
Hi, I am wondering how can i write only 80 characters to a File.txt file from a string variable line which has more than 100 characters. But rest of the characters should start on a new line in the same file from 81-100. How can i do.
String line=;
FileStream fs = new FileStream("C:\\File.txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(line);
Thanks
|
|
|
|
|
I'll give you a hint: String.ToCharArray
You should be able to complete your homework now.
only two letters away from being an asset
|
|
|
|
|
String line= yourestring.Insert(80,System.Environment.NewLine);
|
|
|
|
|
Use the Substring method to get different parts of a string:
sw.WriteLine(line.Substring(0, 80));<br />
sw.Write(line.Substring(80));
-- modified at 19:16 Wednesday 10th January, 2007
Corrected line,Substring to line.Substring
---
Year happy = new Year(2007);
|
|
|
|
|
substring can give string of 0-80 characters but if i want to to get more strings from 91-100 then it wouldn't work because the second parameter for substring ask how many character you want so i can't even have string.substring(80,string.length).
|
|
|
|
|
umm....Chief, even with the logic that you provided, you could get the 'number of characters that you wanted' by providing
string.substring(80, (string.length-80));
|
|
|
|
|
Look at the code that I gave you. What do you think that the second line does?
If it's not obvious to you, look up the documentation for the Substring method, especially the overload that takes a single parameter.
---
Year happy = new Year(2007);
|
|
|
|
|
...are you saying that to me?
if(you_are)
{
ummm....dude: wasn't replying to you. I was replying to op's post of :
substring can give string of 0-80 characters but if i want to to get more strings from 91-100 then it wouldn't work because the second parameter for substring ask how many character you want so i can't even have string.substring(80,string.length).
..and if you look carefully at the context of my message, you will notice this.
}
else
{
make sure that you reply in the correct context. The way you replied implies that it is tagged to my response.
}
(Nyquist Rate || ! Nyquist Rate)
|
|
|
|
|
Alaric_ wrote: ...are you saying that to me?
Of course not. I replied to netJP12L.
make sure that you reply in the correct context.
I did. I have done this 5000 times before, I think that I have got the hang of it by now...
The way you replied implies that it is tagged to my response.
No, it doesn't. It's just you who aren't familiar with how the tree structure of the thread is displayed. Perhaps it's the lack of the actual tree branches that is confusing?
---
Year happy = new Year(2007);
|
|
|
|
|
...no. The thread spanned 2 pages and the posts in question were on a separate page. Whenever I read your message, I could have sworn it was nested 3 deep
(Nyquist Rate || ! Nyquist Rate)
|
|
|
|
|
Thanks guys i have done it with all of your help. I finally figure out what i really wanted to do.
|
|
|
|
|
Hi all,
My boss has just had a DVMR-N16CD installed along with 6 camera's.
The software viewer (DVR Remote Viewer) connects to the DMVR via port 50000 but when I telnet to that port I get nothing, I have also tried using a Socket connection to connect but receive nothing.
I then used ethereal and watched the communications between my computer and the DMVR using the DVR Remote Viewer and all is fine. I try to replicate the TCP Negotiation but I still get no response.
Anyone had any experience on this?
Regards
Gav
|
|
|
|
|
|
I'm glad someone replied.
It's not so much an C# issue but I would like to use C# to access my DVR Recorder.
I've found some handshakes but they don't seem to respond.
Any idea's?
Gav
|
|
|
|
|
figure out what's different between the working packets you've captured and disassembled and the packets your nonworking app is generating. Change your app to send the correct packets.
Sorry I can't be more helpful but unless your vendor has a forum for this sort of task I doubt you'll be able to find anyone whose done what you're trying to do.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
I've managed this before with Telnet as Ethereal has support to decode Telnet Neg commands but I cannot find anything to suggest what is being used apart from TCP.
If I use a Stream and TcpClient I can connect but I do not receive anything even if I send the packet that is being sent via the software.
I've tried looking all over, it seems that the manufacture can not be found anywhere.
Gav
|
|
|
|
|
Is it just me or are there an increasing number of questions being asked that are answered in the documentation on MSDN? I know that MSDN can be a bit vague sometimes on the more esoteric topics, but these are increadibly basic questions that are actually quite well documented.
|
|
|
|
|
Colin Angus Mackay wrote: Is it just me or are there an increasing number of questions being asked that are answered in the documentation on MSDN? I know that MSDN can be a bit vague sometimes on the more esoteric topics, but these are increadibly basic questions that are actually quite well documented.
Must be term time again.
|
|
|
|
|
There are also questions like these that are clearly listed in the CodeProject FAQ that it should be placed in 'The Lounge' or 'Soapbox'
(or using too many laughing smiles)
|
|
|
|
|
It's not just you. There are some questions that are so blatantly obvious they shouldn't even be asked.
only two letters away from being an asset
|
|
|
|
|
It's not just you. The standard of question does seem to be in decline.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all,
Can anyone tell me the line of code to count the no of rows in the datagrid
thx also tell me what is this visible rows concept
Bye
|
|
|
|
|
Are you binding it? If so, check the datasource for the number of rows.
|
|
|
|
|
Is there not a property such as Count or RowCount , or a collection of rows which you can then Count .
|
|
|
|