![]() |
| | #1 |
| Registered User Join Date: Feb 2003
Posts: 17
| 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 | |
| | #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 | |
| | #3 |
| Registered User 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 | |
| | #4 |
| Registered User Join Date: Feb 2003
Posts: 17
| It truns out that a full path is needed. stream=fopen("c:/mydocu~1/programming/peekaview/t2.tre","r"); Thanks... |
| Ray Schmidt is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |