Вопрос по mkstemp
От: Irina Ivanova  
Дата: 28.08.03 21:22
Оценка:
Не могу создать темповый файл. К примеру:

#include <stdlib.h>

int main() {

mkstemp ("/tmp/abc.XXXXXX");

return 0;
}

Компилируется нормально: gcc temp.c

Но при запуске a.out вылетает в кору.

Система Linux RH 7.1.

Подскажите, пожалуйста, что не так?
Re: Вопрос по mkstemp
От: fAX Израиль  
Дата: 28.08.03 22:35
Оценка:
Здравствуйте, Irina Ivanova, Вы писали:

II>Не могу создать темповый файл. К примеру:


II>#include <stdlib.h>


II>int main() {


II>mkstemp ("/tmp/abc.XXXXXX");


II>return 0;

II>}

II>Компилируется нормально: gcc temp.c


II>Но при запуске a.out вылетает в кору.


II>Система Linux RH 7.1.


II>Подскажите, пожалуйста, что не так?

MKSTEMP(3) Linux Programmer's Manual MKSTEMP(3)



NAME
mkstemp — create a unique temporary file

SYNOPSIS
#include <stdlib.h>

int mkstemp(char *template);

DESCRIPTION
The mkstemp() function generates a unique temporary file name from template. The last six characters of
template must be XXXXXX and these are replaced with a string that makes the filename unique. The file is
then created with mode read/write and permissions 0666 (glibc 2.0.6 and earlier), 0600 (glibc 2.0.7 and
later). Since it will be modified, template must not be a string constant, but should be declared as a
character array. The file is opened with the O_EXCL flag, guaranteeing that when mkstemp returns suc-
cessfully we are the only user.

...Complex problems have simple, easy-to-understand wrong answers...
(Grossman's Misquote of H.L.Mencken)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.