c++.dos.32-bits - Syntax error
- Paul Warren (38/38) Aug 21 2003 Hi Walter/all,
- Walter (5/42) Aug 21 2003 Replace "\"" with '"' and it should work.
- Paul Warren (7/63) Aug 24 2003 Hi Walter,
- Walter (5/9) Aug 24 2003 The first is a character literal, the second is a string literal. You're
Hi Walter/all, Can you tell me what the error is below. Error message reads "need explicit cast to convert from int to *char". The line of the bug is marked by ***** Problem this line ***** Thanks Paul /*-------------------------------------------------------------------------- Function: Correct_temp Purpose: Remove '\' (Backslash) from strings Returns: Nothing -------------------------------------------------------------------------*/ void correct_temp(char *old_temp, char *new_temp,int array_size) { char *old_temp_ptr,*new_temp_ptr; int array_ctr = 0; old_temp_ptr = old_temp; new_temp_ptr = new_temp; while( array_ctr < array_size) { if( *old_temp_ptr == '"') { old_temp_ptr++; array_ctr++; } else if(*old_temp_ptr == "\"") ***** Problem this line ***** { old_temp_ptr++; array_ctr++; } else { *new_temp_ptr = *old_temp_ptr; array_ctr++; new_temp_ptr++; old_temp_ptr++; } } }
Aug 21 2003
Replace "\"" with '"' and it should work. "Paul Warren" <Paul_member pathlink.com> wrote in message news:bi3isl$1h01$1 digitaldaemon.com...Hi Walter/all, Can you tell me what the error is below. Error message reads "need explicit cast to convert from int to *char". The line of the bug is marked by ***** Problem this line ***** Thanks Paul/*--------------------------------------------------------------------------Function: Correct_temp Purpose: Remove '\' (Backslash) from strings Returns: Nothing -------------------------------------------------------------------------*/void correct_temp(char *old_temp, char *new_temp,int array_size) { char *old_temp_ptr,*new_temp_ptr; int array_ctr = 0; old_temp_ptr = old_temp; new_temp_ptr = new_temp; while( array_ctr < array_size) { if( *old_temp_ptr == '"') { old_temp_ptr++; array_ctr++; } else if(*old_temp_ptr == "\"") ***** Problem this line ***** { old_temp_ptr++; array_ctr++; } else { *new_temp_ptr = *old_temp_ptr; array_ctr++; new_temp_ptr++; old_temp_ptr++; } } }
Aug 21 2003
Hi Walter, It Worked thanks, (it compiled anyway) im a bit confused why '"' is equal to "\"" to be honest. Can you explain. Thanks Paul Warren In article <bi4adn$2jpa$2 digitaldaemon.com>, Walter says...Replace "\"" with '"' and it should work. "Paul Warren" <Paul_member pathlink.com> wrote in message news:bi3isl$1h01$1 digitaldaemon.com...Hi Walter/all, Can you tell me what the error is below. Error message reads "need explicit cast to convert from int to *char". The line of the bug is marked by ***** Problem this line ***** Thanks Paul/*--------------------------------------------------------------------------Function: Correct_temp Purpose: Remove '\' (Backslash) from strings Returns: Nothing -------------------------------------------------------------------------*/void correct_temp(char *old_temp, char *new_temp,int array_size) { char *old_temp_ptr,*new_temp_ptr; int array_ctr = 0; old_temp_ptr = old_temp; new_temp_ptr = new_temp; while( array_ctr < array_size) { if( *old_temp_ptr == '"') { old_temp_ptr++; array_ctr++; } else if(*old_temp_ptr == "\"") ***** Problem this line ***** { old_temp_ptr++; array_ctr++; } else { *new_temp_ptr = *old_temp_ptr; array_ctr++; new_temp_ptr++; old_temp_ptr++; } } }
Aug 24 2003
The first is a character literal, the second is a string literal. You're going to need a good reference book on C++, check out some on www.digitalmars.com/bibliography.html "Paul Warren" <Paul_member pathlink.com> wrote in message news:bibj80$1gl7$1 digitaldaemon.com...Hi Walter, It Worked thanks, (it compiled anyway) im a bit confused why '"' is equal to "\"" to be honest. Can you explain.
Aug 24 2003