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?
8 2078
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++?
I forgot to tell it to clear().
Really??
I thought you needed to re-open the file using ios_base::beg.
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??
If this is C, then the rewind(); method would take you back to the starting position of the file.
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.
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++?
On a side note: How do you set the width and height of the command prompt from within C++?
Start a new thread, please.
That I Can Do. Thanks for all the help guys
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 little
bit about what I'm getting back. When I try to get the arrays from
another file using the accessor methods, I get no array back. Within
the file that contains the arrays, I can access them by global name and
also by the accessor methods....
|
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 works fine. If the
file does not exist, it saves the file (Word.doc), if it does exists,
it checks to see if the file is open. If it is open, and another user
is trying to save or overwrite the same file, I trap an Error 3002
(document open),...
|
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 , for example, when the file doesnt exists, i should not return any
reference to a bad constructed object, so i need something as a NULL
reference object. I suppose i could return a pointer instead, but i have
some code written with references which...
|
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 bc;
string s;
bc = Request.Browser;
....
|
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 returning). The code I am
using is:
Dim poemstreamreader As System.IO.StreamReader
poemstreamreader = System.IO.File.OpenText(Global.Poems(poemtitle))
cellPoemText.Text = poemstreamreader.ReadToEnd()
| |
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 between the "normal" FALSE and the
"error" FALSE. So why not using NULL instead to indicate an error? Are there
drawbacks I am not aware of?
Greetings,
Thomas
|
by: Yevgen Muntyan |
last post by:
Hey,
Consider the following code:
void func (void)
{
}
void func2 (void)
{
|
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
http://msdn2.microsoft.com/en-us/library/ms996381.aspx
Formerly, with classic Microsoft DNA architecture, the ADO Recordset was a
primary transport medium, recommended for transmitting data between
application tiers. In fact, there are whole books written on the subject.
|
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 from that function and, 1) search for a match from user-inputted names, 2) replace the old name (scanned by the second function) with the new name, and 3) save it back to the original file. The file contains info that was input to it by another PHP...
|
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 it return that temporary class so I
can assign it to a permanent class in the main program.
I've written an assignment operator.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |