   ifstream vs. FILE
  Personally i see no difference. And i prefer ifstream. BUT i found out some nifty functions from the FILE. but does any one know a major difference? 
  fstream==c++ standard.stdio FILE==c standard.    ;  About the only statement I can make about the difference between C++''s stream IO and the C''s stdio functions without starting a flame fight is that there tend to be more vendor specific extensions available that use FILE pointers that don''t have equivilants for stream objects than vice versa. For example: in MSVC the _popen() function. If there''s as simple a way to do that using streams, I haven''t run across it. ;  It should me noted that ifsream is considerably slower than FILE.  On tests I have just conducted it takes 534012 nanoseconds or .53 milliseconds to open a file for reading using ifstream.  for fopen it takes 88808 nanoseconds or ~.088 milliseconds  I never use cpp methods because there are usually better and faster c functions   [edited by - mdog1234 on February 1, 2004 11:18:27 PM];quote:Original post by mdog1234  It should me noted that ifsream is considerably slower than FILE.  On tests I have just conducted it takes 3 milliseconds to open a file for reading using ifstream.  for fopen it takes .33 milliseconds.  I never use cpp methods because there are usually better and faster c functions   WAIT! there is one new/delete > malloc/free    ;  I was wrong the times were for writing, i have made modifications to my previous post ;  Time to use malloc7468 nanoseconds0.007468 milliseconds0.000007 secondsTime to use new11896 nanoseconds0.011896 milliseconds0.000012 secondsTime to use free2304 nanoseconds0.002304 milliseconds0.000002 secondsTime to use delete20864 nanoseconds0.020864 milliseconds0.000021 seconds;quote:Original post by mdog1234   It should me noted that ifsream is considerably slower than FILE.  On tests I have just conducted it takes 534012 nanoseconds or .53 milliseconds to open a file for reading using ifstream.  for fopen it takes 88808 nanoseconds or ~.088 milliseconds  I never use cpp methods because there are usually better and faster c functions   welcome to the world of pointless benchmarking.let see, do i want a system which is exception safe (as in will clean itself up when it goes out of scope), self contained, automagicaly closing and a host of other things i'm too tired to work out... or, a FILE * I have to worry about myself and save .44 millseconds on opening a file, something i'm only going to do rarely and never at a time critial period... Edit: and i really hope the above post isnt trying to advocate the useage of malloc/free over new/delete as they do different jobs...    [edited by - _the_phantom_ on February 1, 2004 11:26:26 PM];  c saves time in many occasions.  There is nothing u can do in c++ that you cant do in c.  Really if you can do it in assembly that is the way to go.  No its not i think u should use whatever you want.  To be honest I use new and delete more than i use free and malloc   [edited by - mdog1234 on February 1, 2004 11:28:00 PM];quote:Original post by mdog1234  Time to use malloc7468 nanoseconds0.007468 milliseconds0.000007 secondsTime to use new11896 nanoseconds0.011896 milliseconds0.000012 secondsTime to use free2304 nanoseconds0.002304 milliseconds0.000002 secondsTime to use delete20864 nanoseconds0.020864 milliseconds0.000021 seconds i never sed it was faster i said it calls malloc and calloc in ways in which it allocates memory better. and delet only works well with new.