From: Jack Klein Newsgroups: comp.os.msdos.djgpp Subject: Re: Char to Int Message-ID: <8aviOQJFsqLNejHQEsWJk7JTrdYF@4ax.com> References: <8ru734$ab7$1 AT nnrp1 DOT deja DOT com> X-Newsreader: Forte Agent 1.6/32.525 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 18 Date: Tue, 10 Oct 2000 05:42:33 GMT NNTP-Posting-Host: 12.75.173.133 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 971156553 12.75.173.133 (Tue, 10 Oct 2000 05:42:33 GMT) NNTP-Posting-Date: Tue, 10 Oct 2000 05:42:33 GMT Organization: AT&T Worldnet To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Tue, 10 Oct 2000 04:48:37 GMT, stryyker16 AT hotmail DOT com wrote in comp.os.msdos.djgpp: > Currently I am reading a binary file data as Char type. How do I > convert this to 8 bit int? How do I convert back? I am writing a tool > to manipulate wav files. If you are reading binary data files make sure you open them in binary mode, that is use "rb" instead of just "r". Also you are better off reading them as unsigned chars, rather than plain chars. A char in C and C++ is just a small integer. In the case of DJGPP it is an 8 bit integer already. You don't have to do anything to it to convert it. Jack Klein -- Home: http://jackklein.home.att.net