🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #308476

Re: Rozmiar tablic zawierających łańcuch

#308476
From: M.M.
Date: Thu, 28 Apr 2016 17:05
32 lines
2261 bytes
On Thursday, April 28, 2016 at 6:24:27 PM UTC+2, m.laba...@gmail.com wrote:
> > #define BUFSZ 20 
> > char s1[20]; 
> > char s2[BUFSZ]; 
> > sprintf(s1,"%%%ds",BUFSZ-1); 
> > scanf( s1, s2 ); 
> > s2[BUFSZ-1] = 0; 
> 
> Wykorzystanie preprocesora:
> 
> --{beg:foo.c}------------------------
> #include <stdio.h>
> #include <stdlib.h>
> #define DEF2STR(x) DEF2STR_(x)
> #define DEF2STR_(x) #x
> int main(void)
> {
>   #define BUFSZ 20
>   char s[BUFSZ + 1];
>   scanf(s, "%" DEF2STR(BUFSZ) "s");
>   s[BUFSZ] = '\0';
>   return EXIT_SUCCESS;
> }
> --{end:foo.c}------------------------
> 
> Pozdrawiam
> 
> -- 
> Maciek

Można i tak jak napisałeś.
Pozdrawiam
Technical Details
Message-ID: <4b541936-b43f-44da-93f9-a87ec7cf3b96@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!11no9171qgt.0!news-out.google.com!k10ni270igv.0!nntp.google.com!sq19no2030690igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <57160720$0$662$65785112@news.neostrada.pl> <57161682$0$3298$426a74cc@news.free.fr> <a0165c1b-9941-4529-bad1-b6430ce56289@googlegroups.com> <571631e8$0$7124$426a34cc@news.free.fr> <nfivof$vgc$1@node1.news.atman.pl> <68bdfc17-ad20-45f5-9cd7-76638518dae8@googlegroups.com> <67af967c-53b6-484e-8685-0d542510f2d9@googlegroups.com>

Show Full Headers
Complete Article Headers
X-Received: by 10.176.3.132 with SMTP id 4mr10411418uau.3.1461863118377;        Thu, 28 Apr 2016 10:05:18 -0700 (PDT)
X-Received: by 10.50.112.166 with SMTP id ir6mr616578igb.2.1461863118333; Thu, 28 Apr 2016 10:05:18 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin3!goblin.stu.neva.ru!news.ripco.com!news.glorb.com!11no9171qgt.0!news-out.google.com!k10ni270igv.0!nntp.google.com!sq19no2030690igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.c
Date: Thu, 28 Apr 2016 10:05:18 -0700 (PDT)
In-Reply-To: <67af967c-53b6-484e-8685-0d542510f2d9@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=178.37.232.66; posting-account=xjvq9QoAAAATMPC2X3btlHd_LkaJo_rj
NNTP-Posting-Host: 178.37.232.66
References: <57160720$0$662$65785112@news.neostrada.pl> <57161682$0$3298$426a74cc@news.free.fr> <a0165c1b-9941-4529-bad1-b6430ce56289@googlegroups.com> <571631e8$0$7124$426a34cc@news.free.fr> <nfivof$vgc$1@node1.news.atman.pl> <68bdfc17-ad20-45f5-9cd7-76638518dae8@googlegroups.com> <67af967c-53b6-484e-8685-0d542510f2d9@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4b541936-b43f-44da-93f9-a87ec7cf3b96@googlegroups.com>
Subject: Re: Rozmiar tablic zawierających łańcuch
From: "M.M." <mmarszik@gmail.com>
Injection-Date: Thu, 28 Apr 2016 17:05:18 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit