0

Hi. I have one silly problem. I'm trying to read from file with ReadFile.read(ReadBuff, 1); char by char and i need to convert them to ascii code. With normal ascii symbols it's all right. But them i'm trying to convert extended ascii symobl to ascii code it gives me negative value. I'm using int ascii = int(ReadBuff); Any ideas?

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by lukename
Featured Replies
0
char m_ReadBuff;
char *p_ReadBuff = &m_ReadBuff;
ReadFile.read(p_ReadBuff, 1);
m_SymbolInt = int(m_ReadBuff);

Unsigned int isn't working too.

0

Yeah I would try

unsigned char m_ReadBuff;
unsigned char *p_ReadBuff = &m_ReadBuff;

Edited by gerard4143: n/a

0

std::basic_istream<_Elem,_Traits>::read' : cannot convert parameter 1 from 'unsigned char *' to 'char *'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Not working too

Edited by lukename: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.