Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reading Image from Office Applications Pin
amohammed2-Jan-04 5:46
amohammed2-Jan-04 5:46 
QuestionHow to create dynamic rectangle on window form? Pin
kseema1-Jan-04 22:19
kseema1-Jan-04 22:19 
AnswerRe: How to create dynamic rectangle on window form? Pin
Mazdak1-Jan-04 22:50
Mazdak1-Jan-04 22:50 
AnswerRe: How to create dynamic rectangle on window form? Pin
Colin Angus Mackay1-Jan-04 22:57
Colin Angus Mackay1-Jan-04 22:57 
GeneralControl development quesions Pin
Den2Fly1-Jan-04 22:05
Den2Fly1-Jan-04 22:05 
GeneralRe: Control development quesions Pin
Mazdak1-Jan-04 22:45
Mazdak1-Jan-04 22:45 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 5:28
protectorHeath Stewart2-Jan-04 5:28 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 6:11
Mazdak2-Jan-04 6:11 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 6:47
protectorHeath Stewart2-Jan-04 6:47 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 7:23
Mazdak2-Jan-04 7:23 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 9:03
protectorHeath Stewart2-Jan-04 9:03 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 9:52
Mazdak2-Jan-04 9:52 
GeneralRe: Control development quesions Pin
Heath Stewart2-Jan-04 10:05
protectorHeath Stewart2-Jan-04 10:05 
GeneralRe: Control development quesions Pin
Mazdak2-Jan-04 10:26
Mazdak2-Jan-04 10:26 
QuestionRSS in these messageborads??? Pin
Mohsen Sajjadi1-Jan-04 21:24
Mohsen Sajjadi1-Jan-04 21:24 
AnswerRe: RSS in these messageborads??? Pin
Colin Angus Mackay1-Jan-04 22:16
Colin Angus Mackay1-Jan-04 22:16 
AnswerRe: RSS in these messageborads??? Pin
Heath Stewart2-Jan-04 5:19
protectorHeath Stewart2-Jan-04 5:19 
GeneralNot sure? Help! Pin
Member 7957781-Jan-04 17:58
Member 7957781-Jan-04 17:58 
GeneralRe: Not sure? Help! Pin
Colin Angus Mackay1-Jan-04 22:11
Colin Angus Mackay1-Jan-04 22:11 
QuestionC# StreamReader blocks ? Pin
Luther Baker1-Jan-04 11:26
Luther Baker1-Jan-04 11:26 
AnswerRe: C# StreamReader blocks ? Pin
Colin Angus Mackay1-Jan-04 11:53
Colin Angus Mackay1-Jan-04 11:53 
GeneralRe: C# StreamReader blocks ? Pin
Luther Baker1-Jan-04 19:22
Luther Baker1-Jan-04 19:22 
GeneralC# select equivalent Pin
Luther Baker1-Jan-04 11:20
Luther Baker1-Jan-04 11:20 
GeneralRe: C# select equivalent Pin
Heath Stewart2-Jan-04 5:12
protectorHeath Stewart2-Jan-04 5:12 
Are you talking about 'tail' that writes a certain number of lines from the end of a file? First of all, this is open source so you can see how they do it. Second of all, why are you reading a single byte at a time?! You should be using a buffer, a.k.a. byte[] array. Finally, since 'tail' reads lines, you shouldn't be using buffers anyway, unless you want to parse the line endings which are different from OS to OS (and you should take into account all the different line ends like \n, \r\n, etc., to be compatible with *nix's 'tail').

Also, is this for academic purposes, or do you just need a utility to do so? If the latter is true, just download Cygwin[^] and put the bin directory in the %PATH% environment variable. If has many of these handy *nix utilities and it works great. It's also commonly used to easily port other *nix applications to Win32.

I don't know how 'tail' works exactly, or rather what is the best way to get the last 10 (default; or user-specified) lines. 'head' would obviously be easier! Smile | :) The best thing I could think about is to write a custom queue that only stores 10 lines (or a custom amount), automatically pushing the first one out when a new line is added. When you reach the end of the file, just print-out the queue. Based on some 'tail'-like source I've seen, this is pretty much the way it works (but I couldn't find the actual 'tail' source and don't have the source tarballs or SRPMs on my linux system).

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: C# select equivalent Pin
Luther Baker2-Jan-04 7:58
Luther Baker2-Jan-04 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.