file stream's visibility
first of all accept my apologies for bad English.
(I am not a native English speaker)
I already posted this on comp.lang.c++.And no one answered me yet :-(
I am a 1st year B.Sc CS student.
This is about file handling.
I am writing a program to receive feedbacks from students about ther
professors and then give a tabular output.
This is for whole college.(Actually program was already written by my
friend in Visual Basic-but I need to write it myself in the one and
only one language I currently known-Java and Python study are
In my program I used a file handle object as
in the global section.
And I have many functions,and they are called each other within
If both of them need the same file to work with.
ie., One function is used to enter some details to the file (In my
program it is a structer of professors-which contains details about
professor).Another is used to verify that that particular professor is
not in the list-to reduce redundancy.
I call the first function and use the global fstream object data to
open a file.
//FBA shorts for Feed Back Agent-this is what the name I gave it.
//I think there is no problem for naming the file as *.FBA,Am I?
then receive user input to the structure object which is also global
then before adding it to the file,call the second function with the
structure as argument.note that now file is not closed explicitly.In
the second function too we need the above file "professor.FBA" to work
Now my question is that whether I can use the file with the data
object(which is connected to the file and I never closed it.)
I am a little bit confused, because after the first function become
out of scope the file may be automatically closed,I am not sure :-( .\
Can you experienced people help me?
I need clarification.
I am using file because I don't know how to connect to mySQL or even
access( I am not prefer it because I need my programs works on Linux
Can you give me any reference to this matter( database connectivity)
I am using Dev C++ and Visual C++ 6 and turbo c++. first two are used
very often because I don't know GUI programming.
And in Linux Anjuta IDE.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]