🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #3669

Re: binary string als int afdrukken in C

#3669
From: Gunter Schelfhout
Date: Sun, 30 Nov 2003 08:35
21 lines
1650 bytes
Gunter Schelfhout wrote:

[knip]

>> 
>> De functies strtol/strtoul accepteren een 'base' parameter, die in het
>> gebied 2 (binair) t/m 36 mag liggen.
> 
> We zullen eens kijken in de documentatie.
> Bedankt.

Een eigenaardigheidje:
...
printf("%i\n", strtol(bin, NULL, 2));
...
geeft altijd hetzelfde resultaat, ongeacht de string van 32 bits.
Een printout van bin geeft bv:
11011000000011001100100000100000

-- 
Blood, sweat & tears
Technical Details
Message-ID: <WYhyb.52209$yO2.1718407@phobos.telenet-ops.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
References: <td1yb.50435$xX1.1629315@phobos.telenet-ops.be> <slrnbshhuh.3sc.staf_nospam_@localhost.staflaptop> <bqaho7$tou$1@netlx020.civ.utwente.nl> <kbayb.51726$RJ2.1708097@phobos.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,12763d3d6faef1bf
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2003-11-30 00:35:03 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!feed1.news.be.easynet.net!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
From: Gunter Schelfhout <nospam@please.com>
Subject: Re: binary string als int afdrukken in C
Newsgroups: be.comp.programming
References: <td1yb.50435$xX1.1629315@phobos.telenet-ops.be> <slrnbshhuh.3sc.staf_nospam_@localhost.staflaptop> <bqaho7$tou$1@netlx020.civ.utwente.nl> <kbayb.51726$RJ2.1708097@phobos.telenet-ops.be>
Lines: 21
User-Agent: KNode/0.7.2
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Message-ID: <WYhyb.52209$yO2.1718407@phobos.telenet-ops.be>
Date: Sun, 30 Nov 2003 08:35:02 GMT
NNTP-Posting-Host: 213.118.155.190
X-Complaints-To: abuse@telenet.be
X-Trace: phobos.telenet-ops.be 1070181302 213.118.155.190 (Sun, 30 Nov 2003 09:35:02 MET)
NNTP-Posting-Date: Sun, 30 Nov 2003 09:35:02 MET
Organization: Telenet Internet