anilgkts / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

String.toCharArray errors #899

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
in the code from below the twitter post works fine if you use 
(twitter.post("txt here"))
I need a serial event to post.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
 v1.0

Please provide any additional information below.

my code:

//from SerialEvent
const String g("geiger");
String inputString = "g";         // a string to hold incoming data
  char charArray[80];
  ((String)g).toCharArray(charArray, 80);   // error: expected constructor, destructor, or type conversion before 'g'

  boolean stringComplete = false;  // whether the string is complete

void setup()
{
  delay(1000);
  Ethernet.begin(mac, ip);
  // Ethernet.begin(mac);
  Serial.begin(9600);
//  String::toCharArray()  //testing
  inputString.reserve(200); //(200
//  inputString.toCharArray(g, 80);
  if (twitter.post(charArray))
  {

Original issue reported on code.google.com by rmacar...@gmail.com on 24 Apr 2012 at 9:03

GoogleCodeExporter commented 9 years ago
It looks like you're trying to put a statement (the call to toCharArray()) 
outside a function, which won't work.

Original comment by dmel...@gmail.com on 9 May 2012 at 12:53