Hi

I am learning c++ at school. I am supposed to submit a project this year end. I would like to create an offline mail server using c++; something in which you can create an account and read & send messages to other existing accounts in the same computer. Once I manage to perfect this, I would like to extend it upto a LAN. I have worked out the basic logic and algorithms for the same. Please help me out!!!

2
Contributors
6
Replies
8
Views
6 Years
Discussion Span
Last Post by Ancient Dragon

You mean like this, but in c++ instead of C#?

more or less the same, it needn't have such hi-fi grapphics though

I haven't the slightest idea how to do it, but I would start with that program and see how it does the basic things.

I have come up with some ideas for signing up and logging in and sending mails. But I want something better. Here are my codes:

//registering
#include<fstream.h>
#include<conio.h>
void main()
{
char pass[20],user[20],c=65;
int k=0;
cin>>user;
while(c!=13)
{
c=getch();
if(c==13)
break;
pass[k]=c;
k++;
clrscr();
for(int j=0; j<k; ++j)
cout<<"*";
}
// creation of file
ofstream ofile("pass.abc");
ofile<<user<<endl;
for(int q=0; q<k; ++q)
ofile<<pass[q];
}

// login
#include<fstream.h>
#include<conio.h>
#include<string.h>
void main()
{
char user[20], pass[20], c=65, us[20], ps[20];
int k=0;
cin>>user;
// for the entered charachters to appear as ****
while(k!=20)
{
c=getch();
if(c==13)
break;
pass[k]=c;
clrscr();
for(int x=0; x<=k; ++x)
cout<<"*";
k++;
}
fstream ifile("pass.abc", ios::in);
ifile.getline(us, 20);
ifile.getline(ps, 20);
if(strcmp(user, us)==0)
{
int flag=0;
for(int y=0; y<k; ++y)
{
if(ps[i]!=pass[i])
flag=1;
}
if(flag==0)
{
}
else
}
else
}
//compose mail
#include<fstream.h>
void main()
{
char to[20], from[20], sub[20], msg[100];
cout<<"TO: ";
cin.getline(to, 20);
ofstream ofile(to);
cout<<"FROM: ";
cin.getline(from, 20);
ofile<<from;
cout<<"SUBJECT: ";
cin.getline(sub, 20);
ofile<<"\n"<<sub;
cout<<"MESSAGE: ";
cin.getline(msg, 100);
ofile<<"\n"<<msg<<endl;
ofile.close();
}

Can somebody help me in creating the inbox? The above codes have been written for Turbo C++ as thats what is used in our school. These codes aren't the final programs that shall make use of. I need to put these together.

Hey I wrote the following code in TURBO C++...

#include <fstream.h>
#include <conio.h>
#include <string.h>
void main()
{
clrscr();
int k=0;
char p[30], u[30], c=65;
cin>>u;
// for hiding the password entered
while(k<30)
{
c=getch();
if(c==13)
break;
p[k]=c;
clrscr();
for(int i=0; i<=k; ++i)
cout<<"*";
k++;
}
ofstream ofile("blog.abc", ios::app);
ofile<<u<<endl;
ofile<<p<<endl;
cout<<"\n SUCCESS ";
getch();
ofile.close();
}

This program seems to work perfectly. But after executing it, i get the following warning when i come back to the editor:

WARNING
BLOG.ABC
date/ time of disk file has changed

If I select yes; then the entered username and password go into the file. Else it doesn't. But when a similar program was written at school it didn't show anything of this sort. Why am I getting this?

maybe its the compiler you are using. Try it with a good current compiler such as Code::Blocks with MinGW compiler or Microsoft VC++ 2010 Express -- both are free.

I just compiled your program with vc++ 2010 express and did not have the problem

#include <stdio.h>

#include <fstream>
#include <iostream>
#include <conio.h>
#include <string.h>
using std::ofstream;
using std::cout;
using std::cin;
using std::ios;
using std::endl;
#pragma warning(disable: 4996)

void clrscr()
{
system("cls");
}

int main()
{
clrscr();
int k=0;
char p[30], u[30], c=65;
cin>>u;
// for hiding the password entered
while(k<30)
{
c=getch();
if(c==13)
break;
p[k]=c;
clrscr();
for(int i=0; i<=k; ++i)
cout<<"*";
k++;
}
ofstream ofile("blog.abc", ios::app);
ofile<<u<<endl;
ofile<<p<<endl;
cout<<"\n SUCCESS ";
getch();
ofile.close();
}

Edited by Ancient Dragon: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.