C4309 warning
-
hi, i am facing C4309 warning while compiling my program. can anyone help me how to solve this warning? -------------- code snippet: CString ws; if (ws.ReverseFind( '>>' ) > -1 ) ---------------------------- Thanks, Rakesh.
Rakesh5 wrote:
i am facing C4309 warning
Please, next time post the full error message, it would avoid people to have to google to know what it is exactly (we don't know all the error codes by heart you know).
Rakesh5 wrote:
if (ws.ReverseFind( '>>' ) > -1 )
You have to use
">>"
instead of'>>'
. Simple quotes (') are used for characters and double quotes (") are used for strings. Here your string will be truncated to a single character.Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
Rakesh5 wrote:
i am facing C4309 warning
Please, next time post the full error message, it would avoid people to have to google to know what it is exactly (we don't know all the error codes by heart you know).
Rakesh5 wrote:
if (ws.ReverseFind( '>>' ) > -1 )
You have to use
">>"
instead of'>>'
. Simple quotes (') are used for characters and double quotes (") are used for strings. Here your string will be truncated to a single character.Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++Sorry for that inconvenience Mr.Moonen. Hereafter, i will try to give detailed picture while posting. When i tried with ">>" , it was throwing an error message. error C2664: 'ReverseFind' : cannot convert parameter 1 from 'char [3]' to 'char' This conversion requires a reinterpret_cast, a C-style cast or function-style cast. can u please tell me where am i coding wrong? Thanks, Rakesh.
-
Sorry for that inconvenience Mr.Moonen. Hereafter, i will try to give detailed picture while posting. When i tried with ">>" , it was throwing an error message. error C2664: 'ReverseFind' : cannot convert parameter 1 from 'char [3]' to 'char' This conversion requires a reinterpret_cast, a C-style cast or function-style cast. can u please tell me where am i coding wrong? Thanks, Rakesh.
ReverseFind only works with single characters. it does not search for strings. ReverseFind[^]
-
ReverseFind only works with single characters. it does not search for strings. ReverseFind[^]
-
Search for a single character or use CString::Find[^] multiple times until the string can't be found anymore (and use the last returned index).
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
int p = str.ReverseFind('>');
if (p > 0)
if (str.GetAt(p-1)=='>')
then you found a match