473,508 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

returning to the top of a file

39 New Member
OK guys, I Open a file, read it, and close it, but when I reopen it, to read it again, it still sits at the end of file... how to I go back to the top of the file before closing it?
Oct 27 '07 #1
8 2068
mohaakilla51
39 New Member
never mind, I figured that out, I forgot to tell it to clear(). However, I have another question, and rather than start a new topic, How do you set command prompt size from within C++?
Oct 27 '07 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
I forgot to tell it to clear().
Really??

I thought you needed to re-open the file using ios_base::beg.
Oct 27 '07 #3
mohaakilla51
39 New Member
no, it actually went back to the top of the file when I re-opened it, but the eof trigger was still set... I needed to clear the file.

So what about my second question??
Oct 27 '07 #4
mattmao
121 New Member
If this is C, then the rewind(); method would take you back to the starting position of the file.
Oct 28 '07 #5
mattmao
121 New Member
BTW, in C the fopen method should bring you to the starting position every time you call it. I don't know why you have that kind of weird situation after you close the file stream and exit. Anyway, use the rewind() method is to take you back to the starting position of the file in your file process.
Oct 28 '07 #6
mohaakilla51
39 New Member
OK guys, I figured out that problem, it did actually go back to the start of the file, I just hadn't cleared the eof property, so when I tested, it told me it was at the end of file already.

On a side note: How do you set the width and height of the command prompt from within C++?
Oct 28 '07 #7
weaknessforcats
9,208 Recognized Expert Moderator Expert
On a side note: How do you set the width and height of the command prompt from within C++?
Start a new thread, please.
Oct 28 '07 #8
mohaakilla51
39 New Member
That I Can Do. Thanks for all the help guys
Oct 28 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1944
by: jeff | last post by:
I have a php file that contains a couple of arrays used for state/country pull-down lists. I have two global arrays and an accessor method for each. I have some simple logging methods, so I know a...
0
1536
by: Bruce Zigenfous | last post by:
Hello, I am using an ASP that uses a third party active-x control to upload a file to a file server using the ADO Stream Object. It uses the FileSystemObject to create folders and files, which...
7
20328
by: Pablo J Royo | last post by:
Hello: i have a function that reads a file as an argument and returns a reference to an object that contains some information obtained from the file: FData &ReadFile(string FilePath); But ,...
4
2802
by: Earl T | last post by:
When I try to get the netscape version for version 7, I get the HttpBrowserCapabilities class returning the version as 5 and not 7. (see code and output below) CODE HttpBrowserCapabilities...
2
1916
by: Nathan Sokalski | last post by:
I am using a System.IO.StreamReader to read a text file that was created with Notepad. It is returning everything except the single quotes (at least that is the only thing I have noticed it is not...
9
5187
by: Thomas Mlynarczyk | last post by:
Hi, It seems to be a generally adopted convention to have a function return FALSE in case of an error. But if a function is supposed to return a boolean anyway, one cannot distinguish anymore...
28
3644
by: Yevgen Muntyan | last post by:
Hey, Consider the following code: void func (void) { } void func2 (void) {
15
13480
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 ...
29
2279
by: tnspc | last post by:
I'm writing code for a class where I've set up functions to load data from a file in the same directory as the PHP file (using the "file" method). Then, the goal is for the program to take the info...
9
2039
by: Hank Stalica | last post by:
So I've made a linked list class. I have a function that initiates this class, opens a file, parses it, and then inserts nodes into this temporary class. What I would like to do is then have...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.