| | |
File Handling
![]() |
•
•
Join Date: Dec 2007
Posts: 205
Reputation:
Solved Threads: 11
hi,
i wanted some help in File handling in C. consider i have one File like a.txt
a.txt
[Marks]
Physics = 60
Chemistry = 80 ;Prac(25)
Maths = 98
[Grade]
Neatness = B
Attention = A ;A+(9.5)
Now suppose i have to insert new values in this file for the subjects or maybe for Grades, then what logic am i suppose to follow?
i wanted some help in File handling in C. consider i have one File like a.txt
a.txt
[Marks]
Physics = 60
Chemistry = 80 ;Prac(25)
Maths = 98
[Grade]
Neatness = B
Attention = A ;A+(9.5)
Now suppose i have to insert new values in this file for the subjects or maybe for Grades, then what logic am i suppose to follow?
Do you want to insert one more record to the file or do you want to modify the current values? In any case please mention how you've approached the problem uptil now.
"You know you're a computer geek when you try to shoo a fly away from the monitor screen with your cursor. That just happened to me. It was scary." - Juuso Heimonen.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
You are right. Have you tried to code such functions? Please post them over here using code tags.
"You know you're a computer geek when you try to shoo a fly away from the monitor screen with your cursor. That just happened to me. It was scary." - Juuso Heimonen.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
You are surely not going to get anyone to write the entire code for you. You know how to do the task. Separate it into several small manageable modules. Write the algorithm in a logical order. Refering to each step in the algorithm, write the corresponding C language statements. After you've written the entire code, compile/run it. Try to debug the errors if any. If you are unable to do so, you will definitely get help from this forum. I don't see in what other way I can help you. Please mention if this is not what you were looking for. In that case you need to be more specific with the kind of help you want.
"You know you're a computer geek when you try to shoo a fly away from the monitor screen with your cursor. That just happened to me. It was scary." - Juuso Heimonen.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
on what i know so far, u cant update the contents directly on to the file (well perhaps u can). Perhaps what i would suggest is read each line from the source file into a string. i.e line by line. See if u need to make some changes in that line. IF so do that changes in the string, and write that string back to a new file. And follow the same for all the lines in the source file and keep on copying it on to the new file. Once u have reached EOF on you old file. Delete the old file and rename the new file to the old filename.
That makes it easy for you.
ssharish
That makes it easy for you.
ssharish
Last edited by ssharish2005; Dec 17th, 2007 at 3:45 am.
![]() |
Similar Threads
- problems with reading random access line from a file (C++)
- C File handling - search within file without reading content? (C++)
- file handling code (C)
- File-based Database Api (C++)
- File Handling Help NEEDED (PHP)
- PHP file handling (PHP)
- problem with convert jumbled text file to unjumbled text file (C)
Other Threads in the C Forum
- Previous Thread: Questions about Linked list.
- Next Thread: Windows Tutorials
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h






