delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/06/17:49:35

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: CHARACTER HELP.
Date: Sat, 06 Sep 1997 20:44:24 GMT
Organization: [posted via] Easynet Group PLC
Lines: 20
Message-ID: <3411bc98.36546154@news.easynet.co.uk>
References: <3411037e DOT 0 AT comnet DOT co DOT nz>
NNTP-Posting-Host: foot.easynet.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 6 Sep 97 07:17:18 GMT, Craig Rennie <carrac AT geocities DOT com> wrote:

>Does anybody know how I could go about changing a single character up 3 
>characters which have been read from a file?
>eg. Reading "c" from a file and converting it to "f".
>    or reading "%" and converting it to "(".

Just add 3 to it.

#include <stdio.h>

int main(void) {
 char ch = getchar();
 ch+=3;
 printf("%c\n",ch);
 return 0;
}

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019