greguk Posted April 2, 2008 Posted April 2, 2008 I have a program for my assignment but I'm struggling with reading/writting to file. If anyone can help I'll be more than happy. if(!ReadRecords("C:\\PDI\\Quotes.txt",Quotes, NumRecords)) { cout << "Failed to find file quotes.txt"; } else { do { system ("CLS"); if(i==0) Quote.QuoteNum =INITIAL_QUOTE_NUMBER; else Quote.QuoteNum =Quotes[NumRecords-1].QuoteNum+1; Quotes[NumRecords]=GetQuote(Quote); NumRecords++; cout << "\n\nEnter another quote?"; cin >> AnotherQuote; } while(AnotherQuote=='Y'||AnotherQuote=='y'); file exist on disk in that location.
ZeroHour Posted April 2, 2008 Posted April 2, 2008 Why not? You never know who has c++ experience. I am more a c#/php sorta person myself so I doubt I am much help.
raufdean Posted April 2, 2008 Posted April 2, 2008 I've been writing c++ for about 12 years... I'd help you but I'm not sure what the question is ? 1
SimpleSi Posted April 2, 2008 Posted April 2, 2008 Why not? We're not an after school ELC are we Its a 1st post and the question isn't even sensible - i suspect spam bot type program. Mind you last time I accused someone of that they went ballistic regards Simon Mind you - full credit to it - I've been trolled into 2 posts
greguk Posted April 2, 2008 Author Posted April 2, 2008 I'm not a spam program. Maybe i didn't precise question right but i just want to have general outlook if anyone have any C++ experience to help me. i didn't want to post my entire program. My program have to read data from file, store them and add new records to the end of this file.
tom_newton Posted April 3, 2008 Posted April 3, 2008 Greg, You've not given us enough information - at least not in the right places. There are a bunch of function calls in there - ReadRecords() for example, which aren't standard, so we have no idea how they work. Ditto your object/struct "Quote", and as for the variable "i" - where is it set, and what significance has it? I would suggest you start again, and do very, very small bits at a time, testing weach stage thoroughly as you go, Whatever you do, ALWAYS write ecvery line yourself. Don't cut and paste bits of other similar code and expect to tweakl them, or you won't gain the understanding, and when it breaks, you're boned. Don't think anyone's going to write this for you, but I for one would be happy to answer any specific C/C++-y questions, though its been a few years since i had my hackers' hat on!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now