0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
||||||
1 | ||||||
Ошибка Debug Asserition Failed Expression:(stream !=NULL)13.07.2013, 10:40. Показов 3719. Ответов 16
Метки нет (Все метки)
Задание: Написать графф и в нем реализовать алгоритм Дейкстры и обход в ширину и высоту. (Прикрепляю код и скрин с ошибкой) помогите, кто сможет. Задание по практике нужно уложиться до 16.07
0
|
13.07.2013, 10:40 | |
Ответы с готовыми решениями:
16
Debug Assertion Failed! Expression: is_block_type_valid(header- _block_use) Debug Assertion failed. Line 77. Expression (stream!=0) Expression:(Stream != NULL) Debug asserion failed(expression:_p!=nullptr) |
Модератор
12458 / 7482 / 1753
Регистрация: 25.07.2009
Сообщений: 13,762
|
||||||
13.07.2013, 13:50 | 2 | |||||
BlaMe64, вот, почему так здорово проверять, что возвращают функции вообще и fopen() в частности. 38 строка
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
||||||
13.07.2013, 13:58 [ТС] | 3 | |||||
его что то не устраивает вот в 44 строке именно на нее указывает
0
|
Модератор
12458 / 7482 / 1753
Регистрация: 25.07.2009
Сообщений: 13,762
|
|
13.07.2013, 14:02 | 4 |
BlaMe64, попробую угадать, что именно: файл не открылся, значение in равно NULL
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
|
13.07.2013, 14:30 [ТС] | 5 |
там на скрине все видно, после того,как закрываю отладку, показывает на 44 строку
Добавлено через 5 минут если сможете помогите с правильным построением кода...а то у меня уже мозг вскипает><
0
|
26 / 26 / 7
Регистрация: 05.04.2012
Сообщений: 248
|
|
13.07.2013, 15:10 | 6 |
0
|
Модератор
12458 / 7482 / 1753
Регистрация: 25.07.2009
Сообщений: 13,762
|
|
13.07.2013, 17:54 | 7 |
BlaMe64, оно и так заработает, если файл с входными данными в "правильное" место положить.
Наверное заработает... Если ошибок нет... Добавлено через 2 минуты А 44 строку на скрине отсчитать надо? Номера строк в настройках редактора включить - не?
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
|
14.07.2013, 11:45 [ТС] | 8 |
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
|
15.07.2013, 00:00 [ТС] | 10 |
ну если ты такой остряк то сообщаю файл создан и лежит в папке с ресурсами!
0
|
Модератор
12458 / 7482 / 1753
Регистрация: 25.07.2009
Сообщений: 13,762
|
|
15.07.2013, 01:09 | 11 |
ну так переложи его в папку с исполняемым файлом, или в корень проекта - откуда-нибудь, да подцепится.
0
|
26 / 26 / 7
Регистрация: 05.04.2012
Сообщений: 248
|
|
15.07.2013, 01:20 | 12 |
Короче, вместо того, чтобы искать, где же должен лежать этот файл (возможно там же где и исходник), укажи абсолютный путь к этому файлу и будет тебе счастье.
0
|
Модератор
12458 / 7482 / 1753
Регистрация: 25.07.2009
Сообщений: 13,762
|
|
15.07.2013, 01:36 | 13 |
Ну или так. Тогда предугадывая следующий вопрос: обратные слеши в имени файла должны удваиваться: "disk:\\folder\\file"
0
|
Заблокирован
|
|
15.07.2013, 01:44 | 14 |
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
|
15.07.2013, 11:42 [ТС] | 15 |
0
|
Заблокирован
|
|
15.07.2013, 16:21 | 16 |
ну и теперь скрипя шестеренками пытаемся прийти к умозаключениям.
Добавлено через 4 минуты fopen
Код
fopen(3) BSD Library Functions Manual fopen(3) NAME fdopen, fopen, freopen -- stream open functions LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <stdio.h> FILE * fdopen(int fildes, const char *mode); FILE * fopen(const char *restrict filename, const char *restrict mode); FILE * freopen(const char *restrict filename, const char *restrict mode, FILE *restrict stream); DESCRIPTION The fopen() function opens the file whose name is the string pointed to by filename and associates a stream with it. The argument mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.): "r" Open text file for reading. The stream is positioned at the beginning of the file. "r+" Open for reading and writing. The stream is positioned at the beginning of the file. "w" Truncate to zero length or create text file for writing. The stream is positioned at the beginning of the file. "w+" Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file. "a" Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file. Subsequent writes to the file will always end up at the then current end of file, irrespective of any intervening fseek(3) or similar. "a+" Open for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file. Subse- quent writes to the file will always end up at the then current end of file, irrespective of any intervening fseek(3) or similar. The mode string can also include the letter "b" either as last charac- ter or as a character between the characters in any of the two-character strings described above. This is strictly for compatibility with ISO/IEC 9899:1990 ("ISO C90") and has no effect; the "b" is ignored. Finally, as an extension to the standards (and thus may not be portable), mode string may end with the letter "x", which insists on creating a new file when used with "w" or "a". If path exists, then an error is returned (this is the equivalent of specifying O_EXCL with open(2)). Any created files will have mode "S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH" (0666), as modified by the process' umask value (see umask(2)). Reads and writes may be intermixed on read/write streams in any order, and do not require an intermediate seek as in previous versions of stdio. This is not portable to other systems, however; ANSI C requires that a file positioning function intervene between output and input, unless an input operation encounters end-of-file. The fdopen() function associates a stream with the existing file descrip- tor, fildes. The mode of the stream must be compatible with the mode of the file descriptor. When the stream is closed via fclose(3), fildes is closed also. The freopen() function opens the file whose name is the string pointed to by filename and associates the stream pointed to by stream with it. The original stream (if it exists) is closed. The mode argument is used just as in the fopen() function. If the filename argument is NULL, freopen() attempts to re-open the file associated with stream with a new mode. The new mode must be compatible with the mode that the stream was originally opened with: o Streams originally opened with mode "r" can only be reopened with that same mode. o Streams originally opened with mode "a" can be reopened with the same mode, or mode "w". o Streams originally opened with mode "w' can be reopened with the same mode, or mode "a". o Streams originally opened with mode "r+", "w+", or "a+" can be reopened with any mode. The primary use of the freopen() function is to change the file associ- ated with a standard text stream (stderr, stdin, or stdout). RETURN VALUES Upon successful completion fopen(), fdopen(), and freopen() return a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error. ERRORS [EINVAL] The mode argument to fopen(), fdopen(), or freopen() was invalid. The fopen(), fdopen() and freopen() functions may also fail and set errno for any of the errors specified for the routine malloc(3). The fopen() function may also fail and set errno for any of the errors specified for the routine open(2). The fdopen() function may also fail and set errno for any of the errors specified for the routine fcntl(2). The freopen() function may also fail and set errno for any of the errors specified for the routines open(2), fclose(3) and fflush(3). SEE ALSO open(2), fclose(3), fileno(3), fseek(3), funopen(3) STANDARDS The fopen() and freopen() functions conform to ISO/IEC 9899:1990 ("ISO C90"). The fdopen() function conforms to IEEE Std 1003.1-1988 ("POSIX.1"). BSD January 26, 2003 BSD
0
|
0 / 0 / 1
Регистрация: 13.07.2013
Сообщений: 14
|
|
15.07.2013, 19:12 [ТС] | 17 |
Всем огромное С П А С И Б О прога заработала)) Тему можно закрывать!
0
|
15.07.2013, 19:12 | |
15.07.2013, 19:12 | |
Помогаю со студенческими работами здесь
17
Debug Assertion Failed! Expression: string subscript out of range При запуске выдает expression stream !=null; что делать? Debug Assertion Failed! expression is_block_type valid(header-_block_use) Ошибка file_get_contents failed to open stream: HTTP request failed Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |