Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 19th, 2006, 3:11 AM   #1
jazz
Newbie
 
Join Date: May 2006
Posts: 18
Rep Power: 0 jazz is on a distinguished road
fopen

Can anyone tell wat does this do?? -

_FOpen(Time_File,"r",fp_time);

_Fread(&st_Time,sizeof(TimeHead),1,fp_time,TimeFile);

Thankx
jazz
jazz is offline   Reply With Quote
Old Jul 19th, 2006, 3:50 AM   #2
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
I can't tell you(cus i don't know), but why not google for some c tutorials while waiting and see if not one of those covers it..

-thondal-
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was.
thondal is offline   Reply With Quote
Old Jul 19th, 2006, 3:57 AM   #3
jazz
Newbie
 
Join Date: May 2006
Posts: 18
Rep Power: 0 jazz is on a distinguished road
In C tutorials i have seen- in fopen there are only two parameters passed. But in the above there are 3 paramenters, is it that-

1)fp_time is read into Time_file??
2)then in fread why are fp_time and Time_File both parameters passed??

Can u please explain, i could'nt understand that.

thankx
jazz
jazz is offline   Reply With Quote
Old Jul 19th, 2006, 4:11 AM   #4
Benoit
Expert Programmer
 
Benoit's Avatar
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 579
Rep Power: 5 Benoit is on a distinguished road
I can't find either of those on google...maybe its because they're preceded by an underscore, but _FOpen(Time_File,"r",fp_time); looks like
freopen(const char *path, const char *mode, FILE *stream)
which opens the file whose name is pointed to by *path, and assosiates *stream with it. Its just quicker than doing fclose then open again.

_Fread(&st_Time,sizeof(TimeHead),1,fp_time,TimeFile); Looks like the standard
 fread(void *ptr, size_t size, size_t memb, FILE *stream)
which simply reads size*memb bytes from *stream to *ptr, where size is the size of each array element, and memb is the number of elements you want to read.
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4
Benoit is offline   Reply With Quote
Old Jul 19th, 2006, 4:13 AM   #5
jazz
Newbie
 
Join Date: May 2006
Posts: 18
Rep Power: 0 jazz is on a distinguished road
does it mean that it is opening and reading 2 files at a time??
jazz is offline   Reply With Quote
Old Jul 19th, 2006, 5:15 AM   #6
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
Neither _FOpen() and _FRead() are standard C functions. They are probably vendor specific extensions or (as Benoit has suggested) wrappers for freopen() and fread(). freopen() is used to open a file in place of an existing open stream; it typically does this by closing the open stream (not by opening two files at once).
grumpy is offline   Reply With Quote
Old Jul 19th, 2006, 3:46 PM   #7
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
They can also be macros for fopen and fread.

And the C99 standard for freopen is to return a stream identifier, having tried to close the existing one first, with the new one aimed at another file. Think of it as associating an already open stream to another file. The most common use being redirection of stdin, stdout, stderr.
jim mcnamara is offline   Reply With Quote
Old Jul 19th, 2006, 5:46 PM   #8
linxis
Programmer
 
Join Date: May 2006
Location: USA
Posts: 52
Rep Power: 0 linxis has a little shameless behaviour in the past
Send a message via ICQ to linxis
FOPEN is C++
__________________
Get programming and game creation tutorials and discuss apon you peers at
http://s14.invisionfree.com/tsoft
We also accept custom software requests and new mods will be needed soon
linxis is offline   Reply With Quote
Old Jul 19th, 2006, 6:52 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Excuse me?? Please try to avoid misleading people.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 19th, 2006, 7:43 PM   #10
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by linxis
FOPEN is C++
DaWei's correct, as usual. fopen is part of the C standard library in stdio.h.

You might be thinking of ifstream and ofstream, which are C++ specific.
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling Maverik 6.2 (from C) megamind5005 C 16 May 3rd, 2006 6:41 PM
Can't open .REG files with fopen. Stevo C++ 2 Mar 24th, 2005 5:56 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:01 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC