hello,
in this code i want to call replace function from inline c code, but i get the error listed below, any ideas how to fix this?
thanks
B4R version: 1.80
Parsing code. (0.02s)
Compiling code. (0.05s)
Building project (0.05s)
Compiling & deploying Ino project (Arduino/Genuino Mega or Mega 2560 - COM35) Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
b4r_str.cpp:14: error: conversion from 'B4R::B4RString*' to non-scalar type 'String' requested
String myoriginal = b4r_str::_original;
^
sketch\b4r_str.cpp: In function 'void replace(B4R::Object*)':
sketch\b4r_str.cpp:16:82: warning: invalid conversion from 'B4R::B4RString*' to 'char' [-fpermissive]
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,
from sketch\B4RDefines.h:8,
from sketch\b4r_str.cpp:1:
C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/WString.h:182:7: note: initializing argument 1 of 'void String::replace(char, char)'
void replace(char find, char replace);
^
sketch\b4r_str.cpp:16:82: warning: invalid conversion from 'B4R::B4RString*' to 'char' [-fpermissive]
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,
from sketch\B4RDefines.h:8,
from sketch\b4r_str.cpp:1:
C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/WString.h:182:7: note: initializing argument 2 of 'void String::replace(char, char)'
void replace(char find, char replace);
^
b4r_str.cpp:16: error: void value not ignored as it ought to be
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
exit status 1
in this code i want to call replace function from inline c code, but i get the error listed below, any ideas how to fix this?
thanks
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Private BC As ByteConverter
Private Original As String
Private SearchFor As String
Private ReplaceWith As String
Private Replaced As String
End Sub
Public Sub ReplaceString(sOriginal() As Byte, sSearchFor() As Byte, sReplaceWith() As Byte) As Byte()
BC.ArrayCopy(sOriginal,Original)
BC.ArrayCopy(sSearchFor,SearchFor)
BC.ArrayCopy(sReplaceWith,ReplaceWith)
RunNative("replace",Null)
Return Replaced.GetBytes
End Sub
#If C
String myoriginal = b4r_str::_original;
void replace(B4R::Object* o) {
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
}
#End If
B4R version: 1.80
Parsing code. (0.02s)
Compiling code. (0.05s)
Building project (0.05s)
Compiling & deploying Ino project (Arduino/Genuino Mega or Mega 2560 - COM35) Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
b4r_str.cpp:14: error: conversion from 'B4R::B4RString*' to non-scalar type 'String' requested
String myoriginal = b4r_str::_original;
^
sketch\b4r_str.cpp: In function 'void replace(B4R::Object*)':
sketch\b4r_str.cpp:16:82: warning: invalid conversion from 'B4R::B4RString*' to 'char' [-fpermissive]
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,
from sketch\B4RDefines.h:8,
from sketch\b4r_str.cpp:1:
C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/WString.h:182:7: note: initializing argument 1 of 'void String::replace(char, char)'
void replace(char find, char replace);
^
sketch\b4r_str.cpp:16:82: warning: invalid conversion from 'B4R::B4RString*' to 'char' [-fpermissive]
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
In file included from C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,
from sketch\B4RDefines.h:8,
from sketch\b4r_str.cpp:1:
C:\Program Files\Arduino\hardware\arduino\avr\cores\arduino/WString.h:182:7: note: initializing argument 2 of 'void String::replace(char, char)'
void replace(char find, char replace);
^
b4r_str.cpp:16: error: void value not ignored as it ought to be
b4r_str::_replaced = myoriginal.replace(b4r_str::_searchfor,b4r_str::_replacewith);
^
exit status 1