|
by: Brandon McCombs |
last post by:
This may be the wrong group but I didn't see anything for VC++ so I'm
trying here.
I have a C++ book by Deitel and Deitel that says I can use fstream
File("data.dat", ios::in | ios::out | ios::binary) to declare a file
object with read/write modes turned on for working with binary data.
I've tried this and my file is not created. The only time it is created
is when I specify ifstream or ofstream but not fstream. I've tried
removing the...
|
by: Jaime Montes |
last post by:
I have found that adding in the start of the file the character '-1'
and '-2' I can read the file as a Unicode, and to write any character
I have to write pairs of character so for 'a' I write '0' + 'a'. My
problem is that when I write '\n' or char(10) the ofstream write
char(13) + char(10) when I only need it write char(10), so I want to
remove the char(13) but I don't have a clue in how to do it.
I found this checking the file with a...
|
by: David Briggs |
last post by:
I am using MFC VC++ 6.0
and I have a simple class 'Data' with a CString member var. Name.
I added operator << and >> as:
#include <istream>
#include <ostream>
#include <fstream>
std::ostream& operator<<(std::ostream& fs, const Data& x )
{
|
by: shawn |
last post by:
Hi All,
Am using MSVC6 compiler on a WinXP machine.
Am trying to read a file using std::ofstream;
the problem is that Tofstream.is_open() fails and Tifstream.rdstate()
returns "2" which translates to "The system cannot find the file
specified.".
This is really weird because the said file am tring to read exists on
the disk at the required location.
SNIPPET:-
|
by: Assertor |
last post by:
Hi, All.
(VC++6.0)
I found some strange thins when using getline() and seekg() of
std::ifstream.
After the file position of an open file was shift to the end of the
file,
seekg() did not work rightly. (i.e. I could not move the file position
to the begin or some position using seekg())
|
|
by: Karl |
last post by:
Hey everyone!
I've got a quick question on whether std::ifstream is buffered or not.
The reason is that I have a homework assignment that requires me to
benchmark copying files using different buffer sizes. I ended up doing
this using std::istream::readsome() and std::ostream::write():
// now try writing to the destination file
std::ifstream sourceStream(sourceFilename.c_str(),
std::ios::binary);
|
by: MariyaGel |
last post by:
I have wrote the program and it worked fine until I had to include one more array into it. As you can see below the two arrays of volume and mass are working properly now I need to include a third array which reads in the sample name that coincides with the mass and the volume. I have tried the getline function and that didnt work. This is my first class in computer programming and im very new to it so if i have made obviouse mistakes i...
|
by: marathoner |
last post by:
I tried your advice, and replaced "ifstream" with "std::ifstream". I also
replaced instances of "ofstream" with "std::ofstream". Those syntax errors
were resolved.
When I added "std" to the following statement: m_InFile.open(m_sFileName,
ios::in | ios::binary);
which became
m_InFile.open(m_sFileName, std::ios::in | std::ios::binary);
I get the following errors:
|
by: adramolek |
last post by:
So... I'm trying to get used to using C++ ifstream (or ofstream)
instead of stdio (although I'm having second thoughts). Anyways, I
want to be able to display a meaningful error message if ifstream
fails to open a file, but nothing I read about ifstream says anything
about a reliable place to get an error message. Using stdio I can
simply do:
FILE *f = fopen(filename, "rb");
if (!f)
perror(filename);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
|