Skip to main content
GameDev.net gamedev.net
🔒 Locked

Pointer Error

Started by zackriggle Dec 25, 2002 at 10:04 PM 1 replies 200+ views
Original Post
zackriggle
zackriggle
Alright, this is REALLY pissing me off... Please tell me why this creates errors:
  
//

// int2hex takes a LONG and converts it to hex in ASCII

//

// mqarc - an archive

// mqarc.files - a vector with the members:

//  start, end, name

//

//

	char* buf;
	buf = new char [6];
	for(i = 0; i != mqarc.files.size(); i++)
	{
		// Get file size

		fbuf.open(mqarc.files[i].name);
		fbuf.seekg(0,ios::end); // Get position of last char (total length)


		// Enter vars....

		mqarc.files[i].start = last + 1;
		mqarc.files[i].end = mqarc.files[i].start + fbuf.tellg();
		last = mqarc.files[i].end;

		fbuf.close();

		// Write vars....

		fout << mqarc.files[i].name << endl;
			// Convert the decimal-length to a hex-length in ASCII and write

			strcpy(buf,int2hex(mqarc.files[i].start));
			fout << buf << endl;
			strcpy(buf,int2hex(mqarc.files[i].end));
			fout << buf << endl;
	};
	delete[] buf;
  
================== My (soon-to-be) Cherished Cookie of Appreciation: -- MattB - for WinSock advice --
ShockBoy
ShockBoy
What are the errors?

Before I couldn''t spell engineer, now I are one!
--Before I couldn't spell engineer, now I are one!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.