guys i have a prob i wrote the code for file handling the prob is that the code is working perfectly it also creates the file yet it doesnt store any thing in it and after the del the files it created in my hard disk he wont create any more either here is the code

// file handling flag testing and practise.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<cstdlib>
#include<fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])


{
 fstream out("D:myfoldertest.txt");
char name [10];
int experience;
char city [10];
cout<<"Enter Your Name(Without Space):";
cin>>name;
cout<<"Enter Your City(Without Space):";
cin>>city;
cout<<"Enter Your Experience(Without Space):";
cin>>experience;
cout<<name<<"\t"<<city<<"\t"<<experience<<endl;

system("pause");
return 0;
}

i also used the ofstream but the diff was nil

Recommended Answers

All 3 Replies

Member Avatar for v3ga

You are not writing to the file. Then how can you expect it to be written?
Use proper formatting

thanks it was a silly silly mistake i should have used out instead of cout i am sorry a silly mistake none the less

Member Avatar for v3ga

Ya it was.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.