Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DevLiquidKnight

Question about VC++ 7?

This topic is 5307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The fstream.h file doesnt seem to work ? what is the alternative or is there an alternative the ofstream and ifstream data types in the new version of C++ because i cant seem to get my program i made in VC++ 6 to compile because of it

Share this post


Link to post
Share on other sites
Advertisement
I just tried #include <fstream>

Im using MFC too so it is one of my older projects when I didnt use pure Win32.

It still has errors with my ifstream and ofstream data types..
I have a few other errors with my project as well i havent metioned.. such as

WriteHuge for CFile is not a member?



XListCtrl.cpp(40) : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CXListCtrl::* )(NMHDR *,LRESULT *)' to 'void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT *)'
None of the functions with this name in scope match the target type


This is giving me problems at:

ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnClick)


and

TrayDialog.cpp(47) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CTrayDialog::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type

at:

ON_MESSAGE(WM_TRAY_ICON_NOTIFY_MESSAGE,OnTrayNotify)


however the majority of the problems subside in the ofstream and ifstream routines?

coder requires 0xf00d before continue().

Killer Eagle Software

[edited by - DevLiquidKnight on January 4, 2004 6:11:28 PM]

Share this post


Link to post
Share on other sites
ok after putting the using namespace std;
in the stdafx header.. it kinda works but now it says using
ifstream in;
in.get(ch) no work?
nor does
filebuf::sh_read
and
ios::nocreate

[edited by - DevLiquidKnight on January 4, 2004 6:19:48 PM]

[edited by - DevLiquidKnight on January 4, 2004 6:20:51 PM]

Share this post


Link to post
Share on other sites
well for some code here... sorry if its not my best work .. its rather old but I wanted to convert it to work with VC++ 7 so
errors in ifstream with get i have this:


EncryptFile(CString lpFileName, CString lpOutFile)
{
char ch, szData[MAX_STRING_SIZE];
int n = 0, dat = 0;
ifstream in;
ofstream out;
CString data;
CFile file;
// open for input

in.open(lpFileName);
while(in.get(ch) && !(in.eof()))
{
szData[n] = ch;
n++;
}
in.close();
// close input


data = szData;
data.ReleaseBuffer(n+1);
int v = n-1;
n = 0;
/*
seq[k][i] = Rand[i][k]%256

Ciphering:
if(k % 2 == 0)
cipher[k] = text[k]^seq[k]
else
seq[k] = seq[k] + key
cipher[k] = text[k]^seq[k]

Deciphering:
if(k % 2 == 0)
text[k] = cipher[k]^seq[k]
else
seq[k] = seq[k] - key
text[k] = cipher[k]^seq[k]
*/

// open output

out.open(lpOutFile);
while(n != data.GetLength()-1)
{
if(n % 2 == 0)
{
dat = (int)szData[n] ^ chbuf[v];
}
else
{
dat = (int)szData[n] ^ chbuf[v] ^ key[n];
}
out << (char)dat;
v--;
n++;
}
out.close();
// close output

// do second encryption

return true;
}

Error:

error C2039: 'get' : is not a member of 'std::basic_ofstream<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits
]




filebuf::sh_read
and
ios::nocreate
the code is:

DWORD CCrc32Dynamic::FileCrc32Streams(LPCTSTR szFilename, DWORD &dwCrc32) const
{
#if UNICODE || _UNICODE
return ERROR_NOT_SUPPORTED;
#else
_ASSERTE(szFilename);
_ASSERTE(lstrlen(szFilename));

DWORD dwErrorCode = NO_ERROR;
ifstream file;

dwCrc32 = 0xFFFFFFFF;

try
{
// Is the table initialized?

if(m_pdwCrc32Table == NULL)
throw 0;

// Open the file

file.open(szFilename, ios::in | ios::nocreate | ios::binary, filebuf::sh_read);
if(!file.is_open())
dwErrorCode = file.fail();
else
{
char buffer[MAX_BUFFER_SIZE];
int nLoop, nCount;
nCount = file.read(buffer, sizeof(buffer)).gcount();
while(nCount)
{
for(nLoop = 0; nLoop < nCount; nLoop++)
CalcCrc32(buffer[nLoop], dwCrc32);
nCount = file.read(buffer, sizeof(buffer)).gcount();
}

file.close();
}
}
catch(...)
{
// An unknown exception happened, or the table isn't initialized

dwErrorCode = ERROR_CRC;
}

if(file.is_open()) file.close();

dwCrc32 = ~dwCrc32;

return dwErrorCode;
#endif
}

and for the error for that i get

error C2039: 'nocreate' : is not a member of 'std::basic_ios<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits
]

error C2065: 'nocreate' : undeclared identifier
error C2676: binary '|' : 'const std::_Iosb<_Dummy>::_Openmode' does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
_Dummy=int
]
error C2039: 'sh_read' : is not a member of 'std::basic_filebuf<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits
]
error C2065: 'sh_read' : undeclared identifier


coder requires 0xf00d before continue().

Killer Eagle Software

[edited by - DevLiquidKnight on January 4, 2004 6:28:45 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!