(C++ VC6) File I/O aHEEHEEE

Started by
13 comments, last by Antheus 16 years, 1 month ago
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!
Advertisement
Post some code.

And check your bad self.

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

Friggin crabs!

When I get home I'll post the code, I'm in class atm. WHOOOO
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]
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!
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
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 :)
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.
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.
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.
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

This topic is closed to new replies.

Advertisement