473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

error C2653: 'ios' : is not a class or namespace name

Hi,all
I have code like the following lines, but when I compile this program I
got a: error C2563 : 'ios' : is not a class or namespace name!

//--Code starts here
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>

... ...
fstream fFile;
fFile.open("c:\testfile.dat",ios::binary|ios::in,0 );
fFile<<"XXX";
fFile.seekp(dwBlockSize,ios::beg);

//--Code ends here

ERROR OCCURED --error C2653: 'ios' : is not a class or namespace name

Could anybody tell me why, thanks a lot

Joseph
Jul 18 '06 #1
3 16316
I have code like the following lines, but when I compile this program I
got a: error C2563 : 'ios' : is not a class or namespace name!

//--Code starts here
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
I assume you've got 'using namespace std;' here somewhere?
... ...
fstream fFile;
fFile.open("c:\testfile.dat",ios::binary|ios::in,0 );
fFile<<"XXX";
fFile.seekp(dwBlockSize,ios::beg);
from the documentation it seems that ios is legacy. you should ios_base:
file.seekp( 0, ios_base::beg );

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jul 18 '06 #2
Bruno van Dooren [MVP VC++] wrote:
> I have code like the following lines, but when I compile this program I
got a: error C2563 : 'ios' : is not a class or namespace name!

//--Code starts here
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
#include <iosfwd>
>>

I assume you've got 'using namespace std;' here somewhere?
> ... ...
fstream fFile;
fFile.open("c:\testfile.dat",ios::binary|ios::in,0 );
fFile<<"XXX";
fFile.seekp(dwBlockSize,ios::beg);

from the documentation it seems that ios is legacy. you should ios_base:
file.seekp( 0, ios_base::beg );
ios is a typedef for basic_ios<char(which is derived from ios_base),
so it should work fine with ios (or certainly std::ios), as long as an
appropriate header (<ios>, <iosfwd>, or, bizarrely, <bitset>) is included.

Tom
Jul 18 '06 #3
Yes, thanks a lot!

"Bruno van Dooren [MVP VC++]" <br**********************@hotmail.comдÈëÏûÏ¢
news:eA**************@TK2MSFTNGP03.phx.gbl...
> I have code like the following lines, but when I compile this program
I got a: error C2563 : 'ios' : is not a class or namespace name!

//--Code starts here
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>

I assume you've got 'using namespace std;' here somewhere?
> ... ...
fstream fFile;
fFile.open("c:\testfile.dat",ios::binary|ios::in,0 );
fFile<<"XXX";
fFile.seekp(dwBlockSize,ios::beg);

from the documentation it seems that ios is legacy. you should ios_base:
file.seekp( 0, ios_base::beg );

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


Jul 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Al Cadalzo | last post by:
I get the compile error: "The type or namespace name 'Net' could not be found" on this line of code: Net.HttpWebResponse resp = null; Here are my using directives: using System; using...
2
by: Matthew Louden | last post by:
using System.Data; using System.Data.SqlClient; //etc... SqlConnection conn = new SqlConnection(connString); SQLDataSetCommand myCmd = new SQLDataSetCommand("select * from Test;", conn);...
4
by: Rookie | last post by:
I have two C# VS .Net 2003 projects that compile and execute correctly on their own. I would like the second project to launch from within the first project. Therefore, I added the second...
4
by: kd | last post by:
Hi, I am new to C#. I have created a console C# application. For some reason, Console.Writeline is showing an error - "The type or namespace name 'console' could not be found". Only the...
4
by: Richard | last post by:
Hi All, I am using Visual C++ .Net to create a windows forms application and I am getting the following errors when I do a MessageBox::Show in my Form1.cpp file: Form1.cpp(19): error C2653:...
2
by: Jin | last post by:
Hi there, in CLRconsole program, i met error message : error C2653: 'MessageBox' : is not a class or namespace name regards.
3
by: tuanhoanganh | last post by:
My program has class's name same namespace 's name. Ex namespace clsvoucher public class clsvoucher .......... end class end namespace Can I use Dim a as clsvoucher or I must use Dim a as...
3
by: Atul Thombre | last post by:
Hello, I am developing an application in C# using VS2003 for mobile device. This application is using .Net compact framework. I have added a reference to a third party library I am using for...
16
by: asmx126453 | last post by:
Hey guys i Hope somone can help i have bin looking on the internet but i cant solve it here is the code where i get the error #region Web Form Designer generated code override...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.