| | |
probelm with <fstream>; saving characters
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2004
Posts: 65
Reputation:
Solved Threads: 0
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;
}
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;
}
C++ Syntax (Toggle Plain Text)
cin.getline(words,50,'\n'); //write to it 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
![]() |
Similar Threads
- fstream and saving to a:\ (C++)
- Urgent:need Help (C++)
Other Threads in the C++ Forum
- Previous Thread: Renaming files in C++
- Next Thread: compare
Views: 1991 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







