let me preface this post with the necessary info. This is not for a school assignment or homework. I am doing this as a side project at work.
Ok, if any of you are familiar with tethereal, you know that it runs indefinitely returning packet information to the output buffer. I want to write a program in which the output to tethereal is directly input into the program. Therefore my program must run indefinitely checking the stdin buffer. I have never used the stdin buffer before, so bear with me. My real question is, what is the best way to handle the buffer when the data does not come consistantly? I suppose that I just need to check the a flag or stdin to see if its null (no data) but if it does, transfer the data into my own line buffer until I get a newline in the stream. from there I pass the linebuffer to processed and stored in a data structure. I figure I want it to dump to file its current data every hour, so I must do a time test on that loop that is checking the stdin buffer. I believe there is a timediff function in the time library that could work. Would that do the job? I have the design all down, but just wanted to prod the minds of some of the expert coders on this forum for tips on efficient ways or pitfalls I need to avoid. I am writing it as a console program in visual c++. If you have any comments (no code please), thanks in advance.
Ok, if any of you are familiar with tethereal, you know that it runs indefinitely returning packet information to the output buffer. I want to write a program in which the output to tethereal is directly input into the program. Therefore my program must run indefinitely checking the stdin buffer. I have never used the stdin buffer before, so bear with me. My real question is, what is the best way to handle the buffer when the data does not come consistantly? I suppose that I just need to check the a flag or stdin to see if its null (no data) but if it does, transfer the data into my own line buffer until I get a newline in the stream. from there I pass the linebuffer to processed and stored in a data structure. I figure I want it to dump to file its current data every hour, so I must do a time test on that loop that is checking the stdin buffer. I believe there is a timediff function in the time library that could work. Would that do the job? I have the design all down, but just wanted to prod the minds of some of the expert coders on this forum for tips on efficient ways or pitfalls I need to avoid. I am writing it as a console program in visual c++. If you have any comments (no code please), thanks in advance.