Jump to content
  • Advertisement
Sign in to follow this  
MichaelJackson

(C++ VC6) File I/O aHEEHEEE

This topic is 3776 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

shamona >.< After being comfortable with file i/o management *aHEE* in a console/DOS environment, I tried to take it up a notch and work it through a dynamic DLL *gimme the damn children* - but it crashs no matter what, were the file interfaces ment for a console environment only? I've tried using fcntl.h,iostream, mmio AND FileOpen functions *HOOEEEEEEE* It just crashs! (Where as it works in Console) It is very frustrating, when I thought I was comfortable - all I want to do is read from a BINARY file (None of the text file bs) using a struct. I have used the MSDN Thank you children!

Share this post


Link to post
Share on other sites
Advertisement
Aheehee Michael Jackson is love


#include <FCNTL.h>
#include <io.h>
#include <STDIO.H>
#include <sys\stat.h>

struct EGFileStructure
{
unsigned short CharLen;
int *Char;
};

void Whatever(void)
{
EGFileStructure file;
int fd=open("data.dat",_O_WRONLY | _O_CREAT | _O_BINARY, _S_IREAD |
_S_IWRITE );
file.Char = new int[32];

file.CharLen = sizeof(file.Char) / sizeof(int);

for(int i=0;i<file.CharLen;++i)
file.Char = i;

write(fd,&file.CharLen,sizeof(unsigned short));
write(fd,file.Char,file.CharLen * sizeof(int));

close(fd);
free(file.Char);
}


int main(int argc, char* argv[])
{
Whatever();
return 0;
}


Nobody can seem to help me man! I'm hooked on this stuff and no one wants to give me a hand! Its inacurate to, the sizeof feeling man!

This code works in a console environment, however when I work it through a Win32 APP (OR Dynamic DLL) it crashs at _open.

Michael Jackson never mis-uses things... this is getting personal.

*moon walks out*

[Edited by - MichaelJackson on March 20, 2008 3:53:09 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by MichaelJackson

Nobody can seem to help me man! I'm hooked on this stuff and no one wants to give me a hand! Its inacurate to, the sizeof feeling man!


Michael Jackson never mis-uses things... this is getting personal.

*moon walks out*

I don't think inserting *HOOEEEEEEE* or *aHEE* every other line is gonna get you any help or mentioning the fact that you are still using VC 6!

Share this post


Link to post
Share on other sites
Step 1: Take VC6 CD and set it on fire
Step 2: Throw burnt CD away
Step 3: Download Visual C++ 2008 Express Edition
Step 4: Install
Step 5: Compile your app using VC2008 and see what errors you get.

VC6 is not a C++ compiler. It came out before the first C++ standard, it's iostreams library is total crap, it's STL implementation has bugs in it, the compiler doesn't obay simple scoping rules (for loop scoping is screwed), the compielr frequently crashes when trying to compile templates, the compiler often crashes when compiling normal (non-template) code. The compiler can generate broken output.

Seriously, get rid of VC6 and move to a compiler that's less than a decade old.

EDIT:
Quote:
Original post by MichaelJackson
Aheeeheee. I'm too poor to upgrade to a newer computer system, nor have the capacity to download the express editions simply because their too big :)
You can request them on CD too. Really, if you're doing C++ programming, you need a suitable C++ compiler. VC6 is not a suitable C++ compiler.

Share this post


Link to post
Share on other sites
OK! In all seriousness here -

I have tried running 2005! FOR ALL THE LIFE OF ME - It will not run at the point where it is USEABLE. The IDE alone is VERY VERY VERY VERY slow - I have two horrible computers, one was purchased in 1999 other one was 2002. The fastest is an 800 MHz computer with 128 MB ram with onboard graphics (yay me)

VC6 is an environment that does not SLOW down at all for myself, I am able to use it effeciently. If I had a new computer I'd GLADLY jump into 2008. But for the life of me - All I originally asked was how to do File I/O; not being told to upgrade to future versions of the VS environment.

Thank you all - really. But seriously - all I want is to be able to peform file i/o operations within a dynamic library. Are there an alternates to do this then?

It makes sense with what you said Steve.

Share this post


Link to post
Share on other sites
Quote:
Original post by MichaelJackson
Thank you all - really. But seriously - all I want is to be able to peform file i/o operations within a dynamic library. Are there an alternates to do this then?


There should be no issue with using iostream in a dynamic library, in C++. If you encounter an issue, please provide a complete minimal example to demonstrate it.

Share this post


Link to post
Share on other sites
How about dev-cpp it's small (13.mb) and uses gcc(yes an old one) but still i think it's better than vc6.

http://www.bloodshed.net/devcpp.html

Of course you could just put linux in the system and have everything you want

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!