Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Report Cards
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
baseerisgay




PostPosted: Sun May 18, 2003 2:36 pm   Post subject: Report Cards

I need help making a report card program. I have the enter data and delete data done. I am struggling with how do i update data from my file.
example:
***********************
put : file3, stnum (c), "#", fname (c), "#", lname, "#", stphnum(c), "#", stadd (c)
***********************
that is a put statement for a file so i hope you understand what the output will be. Basically, the program should ask the user for the student number they want to edit. When the type the student number they should be able to update all the information. Please help if you know how to do this. Very Happy [/b]
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Sun May 18, 2003 2:53 pm   Post subject: (No subject)

you will probley need to use the read and wirte fuctions rather then the put in get to do this, alougth you could get all the data put it in an mutly dimeshonal array then edit the data and then dump the aray in the file.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
baseerisgay




PostPosted: Sun May 18, 2003 9:39 pm   Post subject: (No subject)

Ok, see i don't get how to do the last part where i can get the user to update data from a file. I have looked in the tutorial sections but am unable to find anything. I know how to delete a specified file but i don't know how to edit it.
Asok




PostPosted: Sun May 18, 2003 9:51 pm   Post subject: (No subject)

It's in the bloody tutorials!

I'll leave it up to you to find it because I'm not in the mood to search it up for you. Look for File I/O or Input/Ouput or something along those lines.

Edit: Bah! Damn my conscience! it's here: http://www.compsci.ca/bbs/viewtopic.php?p=29#29
baseerisgay




PostPosted: Mon May 19, 2003 10:54 am   Post subject: Clarification

Ok, i know how to read and write to a file. Thats not the problem. My problem is how do i update a file because in turing it overwrites all previouse data. here is an example:
*******************************************************
FILE1 has the following data in it:

Student Number Student Name Student Address
211705 John Smith 123 Fake Street
125236 Mark Jones 555 Evergreen Terrest
*******************************************************

Now if the user types in 211705 they should be able to change the Student Name and Student Address for only that student number. After that the program should write the changed information back into the file without deleting anything else.

I know this is a bit hard and confusing but i hope you understand what i am trying to do, thank you.
Tony




PostPosted: Mon May 19, 2003 11:46 am   Post subject: (No subject)

you have two options here.

1st - overwrite the whole file. Such as even if they edit just one student, you overwrite them all from beginning to the end.

2nd - learn random file access (read/write instead of get/put), that will allow you to just edit the words you need. I think you'll be able to just edit like a street name without even touching student name. Much more efficient.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
naoki




PostPosted: Mon May 19, 2003 2:53 pm   Post subject: (No subject)

this is coming from a total beginner, but you could read from one file and output it right away to a blank textfile if you don't need to change it. then when you read something you wanna change, you change it and output the whole thing to the blank textfile.

you'd basically recreate your old data onto a new one inside your program. basic, but it looks like you might not understand read/write commands.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: