LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-06-2005, 08:55 AM   #1
twirl
Member
 
Registered: Aug 2005
Posts: 132

Rep: Reputation: 15
Sorry to be a pain, but can someone help please?


Hi,

my sourcecode is on http://pastebin.com/356038 . My problem is that i can now create the file, but how do i change the code so that it asks user for the path to filename and then stores that info into games.db please? Thankyou

twirl

andy@hauntedhits.com
 
Old 09-06-2005, 10:19 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,384

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Please use useful thread titles in future. This one mught be polite, but it's not useful at all...

not quite sure what you're really asking anyway... You are already successfully using the cin stream to read a variable so surely you can just use what you already know?
 
Old 09-06-2005, 10:27 AM   #3
twirl
Member
 
Registered: Aug 2005
Posts: 132

Original Poster
Rep: Reputation: 15
Sorry,

ok iv managed to get my code to ask the user for the path to the file, the problem iv now got is when you enter the path, it quits out of my program and dont store it into games.db like what i need it todo. Please help?

Source code :- http://pastebin.com/356142

thankyou
 
Old 09-06-2005, 10:38 AM   #4
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 3,950

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
Code:
ofstream out("games.db");
i think you have to overload the out operator, something like:
Code:
 #include <fstream>
using namespace std;

int main () {

  ofstream outfile;

  outfile.open ("test.txt", ofstream::out | ofstream::app);
  outfile << "This sentence is appended to the file content\n";
  outfile.close();

  return 0;
}
 
Old 09-06-2005, 02:30 PM   #5
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
Re: Sorry to be a pain, but can someone help please?

Quote:
Originally posted by twirl
Hi,

my sourcecode is on http://pastebin.com/356038 . My problem is that i can now create the file, but how do i change the code so that it asks user for the path to filename and then stores that info into games.db please? Thankyou

twirl

andy@hauntedhits.com
if nothing else, thanks for the heads up on a great site to paste code for review, i'm impressed.

- perry
 
Old 09-06-2005, 05:15 PM   #6
twirl
Member
 
Registered: Aug 2005
Posts: 132

Original Poster
Rep: Reputation: 15
Hi,

Thankyou for the help :-). I have now got my program working with it saving the data to the games.db (sourcecode at :- http://pastebin.com/356387) now iv got to work out how to get user to specify location of config file and then open that file for editing.

:-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
lselinux: pain in the @$$ chrisknight Linux - Software 5 08-25-2004 11:51 AM
What a pain BajaNick General 4 08-30-2003 11:15 PM
The Pain... crichards General 11 02-22-2003 05:19 AM
oh the pain, the pain of c bobthebat Programming 2 07-04-2002 11:30 AM
More pain than its worth?? ewaltonl Linux - General 7 03-06-2001 05:10 PM


All times are GMT -5. The time now is 12:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration