Oh boy, where to start..
First, learn to use code tags, its not difficult.
Give more details on your problem, and show the errors you are getting.
Dont use void main.
Try posting this again, but this time.. properly
and then I will help you with your problem.
Read this thread which you should have read anyway before posting.
Read This Before Posting
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
>I really don't understand, what you both mean by saying 'code tags'
What ?!, are you serious. There are so many places on this site that fully explains how they work.. Try reading the link I posted.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
>>cin>>*per;
As mention before, per is a pointer that just points to some random memory location. and *per only references the first byte, not the entire string. Unless the purpose of this assignment is to learn character arrays and pointers, then you would be better off using std::string.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>>I have used char *per because 'write' function only accepts pointer to character.
False. You can put anything you want to there -- just typecast it to char*
But you still failed to correct the problem. per is still an unallocated pointer which will crash your program.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343