473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Read a Log line by line and show error if codes same

hi everyone,
i'm not beginner but i learn programing in hack kind, i don;t have any idea about my problem(in C++ wrote)!!! Read Plz post if u have any Idea, i want to here it, it will be your kind if u post here!!!


i have a program that program creating a log file just like this format,

Year 2009,Month 10,Day 15,Time 11:10:48,Code 432
Year 2009,Month 9,Day 29,Time 11:10:48,Code 442
Year 2009,Month 11,Day 1,Time 11:10:48,Code 495
Year 2009,Month 11,Day 4,Time 11:10:48,Code 415
Year 2009,Month 11,Day 7,Time 11:10:48,Code 400
Year 2009,Month 11,Day 9,Time 14:12:10,Code 415



i need codes for read last line first ,and show Warrning msg if last Code used in earlier than one week (mean 168 hours) !!!
and if times like it :
14:12:10
11:10:48
calculate it in int mean show=3 hours
but if u don't have idea , with time checking forget it !!!


just write codes if program saw last line code if have same code with any line show warning


guys i need help of all u !!! i can change log format just if u have any idea!!! post it here


Regards
Kourosh
Nov 9 '09 #1
7 1910
donbock
2,426 Expert 2GB
Is there a reason you need to use C/C++ to solve this problem? It would be easier to solve this problem using Perl.
Nov 9 '09 #2
newb16
687 512MB
The reason is it's an assignment. (see topic 876678)

2OP - for parsing time like 11:10:48 in your case I'd use sscanf(...,"%d:%d:%d", ...)
Nov 9 '09 #3
@donbock
there is Just one problem, i don't know perl,and i wrote my program with C++ it's better if i use one application!!! but if u can, plz post your perl code, i try to find way to use it!!!


Thank you for giving Time
Regards
kourosh
Nov 9 '09 #4
can u explain a bit more!!!
plz

if u can plz Write a Sample,of course if u have time for it!!!


Regards
Kourosh KDT
Nov 9 '09 #5
@newb16
can u explain a bit more!!!
plz

if u can plz Write a Sample,of course if u have time for it!!!


Regards
Kourosh KDT
Nov 9 '09 #6
newb16
687 512MB
I'm inclined to reply with the traditional reference to http://bytes.com/faq.php?faq=posting..._or_coursework
Did you try to find sscanf reference and apply it to your needs?
Nov 9 '09 #7
@newb16
my home works finished 3 years ago!!!
if i use assigments cuz some times u must ,try solve some question to don't forget what u learn years ago!!!
i pass my Programing exam in univercity with 96 but it's 3 years ago!!! not now !
no one give u homework like this to u !!!
i can ask it from teachers but i think better to ask this from another kinds of programers cuz always u can find some thing on internet , just genius can find it in real,
and if it's home work , i don't ask for perl code !!! see before reply!!! i think it's enough for your answer my friend! ;)
Nov 9 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: see_mun_lee | last post by:
I use asp to develop a web page to read an excel file containing Chinese Character then display it in the web page. Unfortunately, I cant display it!!! it will display (?????????). <META...
4
by: pisscot | last post by:
Lind Apr 13, 6:32 am show options Newsgroups: comp.lang.c From: piss...@gmail.com (Lind) - Find messages by this author Date: 13 Apr 2005 06:32:15 -0700 Local: Wed,Apr 13 2005 6:32 am...
1
by: Chua Wen Ching | last post by:
Hi there, I have some problems when reading XML file. 1. First this, is what i did, cause i can't seem to read "sub elements or tags" values, so i place those values into attributes like this....
1
by: Tolgay Gül | last post by:
I need some codes that able to send and read data by serialport in VB.Net 2005 beta 2. I wrote some codes and It can send data via serialport but It cannot read what I send. I have looked up on...
6
by: Samuel M. Smith | last post by:
I have been playing around with a subclass of dict wrt a recipe for setting dict items using attribute syntax. The dict class has some read only attributes that generate an exception if I try to...
22
by: Brad | last post by:
Hi, Am trying to read one byte at location 0xFFF0 000E in an embedded system. I cast a pointer to int, then try to stuff the above address in, then reference whats at the location? wont...
3
by: phwashington | last post by:
I am new to C++ and have a data file I want to read, which was stored in binary. I have looked at the data with a hex editor and it appears to be correct. Whenever I try to read it though as an...
3
by: Ray | last post by:
Hello World, I made a Windowsform that reads data from a CSV file. It works fine, but when I have read the data of a record I have to re-Debug the form to read another record. So when I put a...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.