probelm with <fstream>; saving characters

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2004
Posts: 65
Reputation: koh is an unknown quantity at this point 
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

probelm with <fstream>; saving characters

 
0
  #1
Aug 31st, 2004
after words are been entered by the user, it saved in the file.txt as address something like 0047D123.
what should i do if i want it to be appeared as in full character??
thank you!

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char words[50];
char *p = words;
ofstream file;

file.open("file.txt"); //open a file

file<<cin.getline(words,50,'\n'); //write to it

file.close(); //close it
return 0;
}
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 255
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: probelm with <fstream>; saving characters

 
0
  #2
Aug 31st, 2004
  1. cin.getline(words,50,'\n'); //write to it
  2. file<<words;
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: probelm with <fstream>; saving characters

 
0
  #3
Aug 31st, 2004
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 65
Reputation: koh is an unknown quantity at this point 
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

Re: probelm with <fstream>; saving characters

 
0
  #4
Sep 1st, 2004
thank you guys
actually i went to that site already
just that don't understand a bit here and there
thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 1991 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC