public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Teenu <brain_damage@eth.net>
To: Mihnea Balta <dark_lkml@mymail.ro>
Cc: Teenu <brain_damage@eth.net>, GCC HELP <gcc-help@gcc.gnu.org>
Subject: Re: [Q] mktemp
Date: Thu, 27 Feb 2003 13:51:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0302271902550.4660-100000@localhost.localdomain> (raw)
In-Reply-To: <200302271442.09124.dark_lkml@mymail.ro>

Thanks Mihnea ! that saved me a lot of time.

Regards,
Tc

On Thu, 27 Feb 2003, Mihnea Balta wrote:

> #include <stdlib.h>
> #include <string.h>
> #include <stdio.h>
>
> int main(){
> 	char	tmp[32];
>
> 	strncpy(tmp, "tmpXXXXXX", 32);
> 	mkstemp(tmp);
> 	printf("%s\n", tmp);
> 	return 0;
> }
>
> You're using a constant string, and you're not allowed to write to constant
> strings.
>
> On Thursday 27 February 2003 13:24, Teenu wrote:
> > Hello List,
> > I wanted to generate tmp files by mktemp() and mkstemp() in a C++
> > program. The use of these 2 functions result in segmentation faults.
> > How do i use these ?
> > Heres how i'm using them
> > ______________________
> > mkstemp("tempXXXXXX");
> > ______________________
> >
> > GCC--> 2.96
> > OS--> RedHat 7.1
> > Kernel--> 2.5.6
> >
> > TIA
> >
> > Tc
> >
> >
> > ------------------------------------------------------------------------
> > P.S. Stiai ca s-a lansat www.FreeSMS.ro ?
>

      reply	other threads:[~2003-02-27 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-27 12:33 Teenu
2003-02-27 12:43 ` Mihnea Balta
2003-02-27 13:51   ` Teenu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0302271902550.4660-100000@localhost.localdomain \
    --to=brain_damage@eth.net \
    --cc=dark_lkml@mymail.ro \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).