473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

I can make a new file but i cant write on it

Develop a simple text editor program. The program will show the user a menu of choices and will act according to his choice. Use functional decomposition to break the system into small functions that are accessed by the main program to provide the system functionality. Using the text editor, the user can:
• Input the name of a file
• The program will check if a file with this name exists or not. If yes, it will tell the user “This File Already Exists” and if not it creates a new file with this name and tell the user “This is a new file. I created it for you ”.
• Then a menu of choices is displayed and the program takes the user’s choice and executes it and loops until the exit choice is entered. The possible choices are:
1. Add new text to the end of the file
2. Display the content of the file
3. Empty the file
4. Encrypt the file content
5. Decrypt the file content
6. Merge another file
7. Count the number of words in the file.
8. Count the number of characters in the file
9. Search for a word in the file
10. Turn the file content to upper case.
11. Exit

The explanation of each of these functionalities is as follows:
1- Adding content functionality will open the file for writing in append mode (which means that the original content of the file is not lost but new the writing will be added to the end of the file) and will allow the user to type in text that is stored in the file, until he presses EOF character (Ctrl+z) which ends the writing and returns the user to the menu.
2- Display content functionality displays the current file content to the user and returns him to the menu.
3- Empty the file clears the file and erases its content and returns to the main menu.
4- Encrypt the file content will re-write the file content but shifted one ASCII character, i.e., each character will be replaced by the character following it in the ASCII table. The menu is re-displayed after the operation. For example, the following file:



I cant understand how this menu works :S
Thanks
Mar 28 '07 #1
12 2057
RedSon
5,000 Expert 4TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

Then when you are ready post a new question in this thread.

MODERATOR
Mar 28 '07 #2
RedSon
5,000 Expert 4TB
With that in mind, what is your specific problem? If you say you do not understand how the menu works, then you need to go talk to your teacher to get it clarified.
Mar 28 '07 #3
Thanks :) i read the guide lines
1st ..i attempted to do the program
i successfully executed the creating of the new file and writing on it cos i kno the codes..
i dont know how this menu is supposed to be done..
and how to search for a word in the file..

my time frame is th nxt 4 days..
Thanks for ur help :)
Mar 28 '07 #4
my professor didnt tell me how the menu works...and i cant reach him

This isy 1st programming course in my 1st year in college so i wanted to undestand the functions i should use to executed the wanted program
Mar 28 '07 #5
RedSon
5,000 Expert 4TB
The basic steps for menus is going to come out like this.

1. Print the menu to the user, ask them to select one by number.
2. Get input from the console, test that it is a valid number.
3. If not valid goto step 1, if valid continue
4. switch on input and go to proper case of number, run code in case to do what user selected.
5. Complete running code in case, and either exit program or goto step 1.

Menu's are not that hard.

Same for searching:

1. Read a line of text from file.
2. Compare line with search keyword.
3. If keyword is in text then you have found it. Otherwise you have not
4. If more file exists goto step 1, If not exit.
Mar 28 '07 #6
RedSon
5,000 Expert 4TB
my professor didnt tell me how the menu works...and i cant reach him
I find this hard to believe. You do not have his email address?
Mar 28 '07 #7
No i dont :D
this is my problem i cant contact either the doctor or my T.As
but thanks for ur help if this is all you can help me with ...i understood some things :)
thanks again
bye
Mar 28 '07 #8
I did the menu and thank soo much
but how can i identify the name of the file?
Mar 28 '07 #9
RedSon
5,000 Expert 4TB
Ask the user to input the name that they want. Then you can open up the file stream based on their input. If they give you a file name that does not exist, you can tell them so and ask for their input again, or just quit the program then.
Mar 28 '07 #10
Thanks so much for your help
i did the menu so far and 4 cases from the menu
thanks again


Ask the user to input the name that they want. Then you can open up the file stream based on their input. If they give you a file name that does not exist, you can tell them so and ask for their input again, or just quit the program then.
Mar 28 '07 #11
sry for askin again'
but how can i count the no. of characters or words in the file?
Mar 28 '07 #12
RedSon
5,000 Expert 4TB
You dont have to be sorry to ask. But you should be sure that you have done a bit of research first. Your question has been asked and answered several times in this forum and on several newsgroups. Try doing a search first and get back to me if you have further difficulties beyond that.
Mar 28 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: chuck amadi | last post by:
Hi I have managed to print the output of the get_payload to screen but I need to write to a file as I only require the email body messages from the mailbox.My script using the fp.readlines()...
0
by: chuck amadi | last post by:
Hi I have managed to print the output of the get_payload to screen but I need to write to a file as I only require the email body messages from the mailbox.My script using the fp.readlines()...
1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
1
by: chuck amadi | last post by:
Hi I have managed to print the output of the get_payload to screen but I need to write to a file as I only require the email body messages from the mailbox.My script using the fp.readlines()...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
1
by: John | last post by:
Dear, We have 2 IIS server on win2000. we use the web server for upload file from server1 IIS to server2 IIS. We can connect from IIS1 to IIS2 success but the file unable to upload with below...
3
by: nicolasg | last post by:
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its...
5
by: grinder | last post by:
first off, i am an extreme newbie to C. i am an undergrad research assistant and i have been shifted to a project that involves building a fairly involved c program. The part that i am stuck on now...
9
by: richee | last post by:
Hi all, I am new to Perl but see that it offers some fantastic opportunities and am trying to use it more in problem solving but could do with a little help on a problem thats driving me nuts.......
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.