C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-21-2003, 09:20 PM   #1
Registered User
 
Ray Schmidt's Avatar
 
Join Date: Feb 2003
Posts: 17
Question Debug Assertion Failed!

I've got a program that works fine while i'm in the VC program, however, when I try to launch the .exe stand alone I get this nasty little message:

Debug Assertion Failed!
Program: C:\My.....
File: fseek.c
Line: 101
Expression: stream != NULL

I'm sure i'm just missing it. Maybe someone can suggest a better way to get i/p from a text file... Any help is appreciated...
Code:
void CPeekaViewDlg::OnGetit() 
{
	UpdateData(TRUE);
	
	FILE *stream;
	char s[255];
	int i=74;
	int convert;
	stream=fopen("t2.tre","r");
	fseek(stream, i, SEEK_SET);
	fscanf(stream,"%s\n",s);
	m_crap = s;
	convert = atoi(s);
	if(convert>9)
	{
		i += 3;
	}
	if(convert<9)
	{
		i += 2;
	}
	fseek(stream, i, SEEK_SET);
	fscanf(stream,"%s\n",s);
	m_show = s;


	fclose(stream);

	UpdateData(FALSE);

}
Ray Schmidt is offline   Reply With Quote
Old 02-21-2003, 09:44 PM   #2
Registered User
 
Join Date: Jan 2003
Posts: 311
my guess, t2.tre does not exist in the same directory. errno will be nonzero if fopen fails and strerr(errno) will proablably have a semi informative message.
grib is offline   Reply With Quote
Old 02-21-2003, 09:52 PM   #3
Registered User
 
Ray Schmidt's Avatar
 
Join Date: Feb 2003
Posts: 17
it exist

The file is present and has data. In fact, the code actually works, but only while the program is compiled/linked/ran from the VC++ program....
Ray Schmidt is offline   Reply With Quote
Old 02-21-2003, 09:58 PM   #4
Registered User
 
Ray Schmidt's Avatar
 
Join Date: Feb 2003
Posts: 17
Lightbulb I've got it!!!! WoooHooo!!!

It truns out that a full path is needed.

stream=fopen("c:/mydocu~1/programming/peekaview/t2.tre","r");


Thanks...
Ray Schmidt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug Assertion Failed! IndioDoido C Programming 31 03-25-2008 11:07 AM
debug assertion failed! chintugavali C++ Programming 5 12-21-2007 04:05 AM
Visual Studio 2005 Debug Assertion Failed natmas C++ Programming 7 07-17-2007 04:28 PM
debug assertion failed ! blue_gene C++ Programming 2 05-09-2004 11:23 AM
debug assertion failed?!? ichijoji C++ Programming 3 08-30-2003 03:23 PM


All times are GMT -6. The time now is 10:37 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22