473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

8 New Member
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 2070
RedSon
5,000 Recognized Expert Expert
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 Recognized Expert Expert
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
lalou89
8 New Member
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
lalou89
8 New Member
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 Recognized Expert Expert
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 Recognized Expert Expert
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
lalou89
8 New Member
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
lalou89
8 New Member
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 Recognized Expert Expert
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

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

Similar topics

1
3768
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() function writes the entire contents of the mailbox of cause including the headers of the emails I do not want. I have tried a few things but I cant get...
0
1317
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() function writes the entire contents of the mailbox of cause including the headers of the emails I do not want. I have tried a few things but I cant get...
1
2386
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 entire line from the file , headers as well > > >as just the desired body messages . > > > > > >fp = file("/home/chuck/pythonScript/testbox") > >...
1
2000
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() function writes the entire contents of the mailbox of cause including the headers of the emails I do not want. I have tried a few things but I cant get...
12
3277
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. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would...
1
1529
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 message. Would u help? If FileUpload_TXT.PostedFile.ContentLength = 0 Then Panel_FileInfo.Visible = False Exit Sub Else
3
18956
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 original form. The problem is tha the binary source that I extract from the text file seems to be diferent from the source I saved. Here is my code: 1)...
5
6189
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 is as follows: - i am trying to write code that will take any number of text inputs (names of other text files) and put them into a file...
9
2131
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.... I am trying to remove certain sub headers from email, i want it to tick through the text until it reaches "content-disposition:" then delete the...
0
7541
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7979
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1074
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.