473,395 Members | 1,458 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,395 software developers and data experts.

any hints would help

Expand|Select|Wrap|Line Numbers
  1.  vector<Log_Entry> parse(string);

This function should do the following:

* Open a log file specified by the parameter name (File I/O).
* Read lines from the opened file.
* Create a Log_Entry object passing the line just input.
* Push each List_Entry object onto a vector.
* Return the vector of Log_Entrys.

so far I have got

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <fstream>
  5. #include "log_view.h"
  6.  
  7. int main();
  8.  
  9.  
  10. std::vector<Log_Entry> parse(string file)
  11. {
  12.  
  13. }
Sep 19 '07 #1
3 1242
Studlyami
464 Expert 256MB
first i recommend doing some research on file I/O. There is an article in the articles section on this website. There are also TONS of examples from your favorite c++ resource. I then would define your log file structure and attempt your homework assignment. Then if you encounter errors or problems come back and post them and we will be more than willing to help.
Sep 19 '07 #2
first i recommend doing some research on file I/O. There is an article in the articles section on this website. There are also TONS of examples from your favorite c++ resource. I then would define your log file structure and attempt your homework assignment. Then if you encounter errors or problems come back and post them and we will be more than willing to help.
I really appreciate this after reading some thing about file I/O, I have gotten to this point but I got errors after defining the structure.

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <fstream>
  5. #include "log_view.h"
  6.  
  7. int main();
  8.  
  9. std::vector<string> split (const string&, char)
  10. {}
  11. std::vector<Log_Entry> parse(string file)
  12. {
  13.   string in_file_name("log_small.txt");
  14.   std::ifstream in(in_file_name.c_str());
  15.  
  16.  
  17. }
Sep 19 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
[quote=sromano]
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include "log_view.h"

int main(); <<<<<<<<<!!!!!!!!!

std::vector<string> split (const string&, char)
{}
std::vector<Log_Entry> parse(string file)
{
string in_file_name("log_small.txt");
std::ifstream in(in_file_name.c_str());


}
[/code]

main() does not have a body!

Also, your functions shoukd return references to a vector rather than a vector. Otherwise, to do the return a copy of the entire vector will need ot be made just to do the return.

A better solution is to return void and pass your vector tio the functions by reference.
Sep 22 '07 #4

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

Similar topics

15
by: Terje Slettebų | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is...
4
by: Kim Petersen | last post by:
I've worked on this table object a bit too long - and seem to have stared too long at the code. Can someone see where it goes wrong in the insertrow function? Also optimization hints and...
2
by: NoeCH | last post by:
Hi guys very simple question here... I'm kind of new to Vb.NET and I'm having a hard time trying to find how to display hints on the components of my form. You know that little yellow tag with...
2
by: C5Guy | last post by:
O wise one's of the .Net World, Can some one give me a few hints/tips on setting up a properties configuration page. What I am trying to achieve is the same sort of thing that VS.Net shows on...
5
by: newtophp2000 | last post by:
I am kind of confused about the way SQL Server 2000 handles the hints that users supply with their SQL statements. >From BOL, it seems that one can specify them with "WITH (...)" clauses in SQL...
2
by: Paul Reddin | last post by:
Hi, I'm sure I read somewhere that the SELECTIVITY Clause cannot be used with static SQL, can anybody confirm/deny this? Also, at the risk of a philosophical war, when will the optimizer...
9
by: Jim Starcher | last post by:
I cannot get the intellisense hints to work on my class constructors. Would you please tell me what I am doing wrong? public class MyObject { //Constructors /// <summary> /// Used to...
3
by: Square eyes | last post by:
Hi, I'm working on a program which scans .Net programs and gives hints and tips. At the moment, it can spell check forms, reports and code and some hints might include something like...
4
by: Lester | last post by:
I need to fire a function 4 times a second using setTimeout()), but I have an HTML-editor on the page (FCKeditor) which has hints over its buttons. However, the rapid timer never allows these hints...
2
by: Andy | last post by:
Hi guys, I'm writing a program with a feature of accepting user input as command text and parsing it to correct function calls...example: "5 minutes later"/"5 min later"/"5 minute...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.