I was working on another project, but this is something different, but I need to know how to client.read() lots of letters
For example,
char Packet[] = client.read();
I've heard it only does one character. Any help?
I was working on another project, but this is something different, but I need to know how to client.read() lots of letters
For example,
char Packet[] = client.read();
I've heard it only does one character. Any help?
The EthernetClient class has:
virtual int read(uint8_t *buf, size_t size);
You need to create the array before hand, and pass the address and the size to the read function. It returns the number of characters actually read, so that you can NULL terminate the array (the method does not).
So this automatically returns the amount of characters in client.read()? Awesome! Isread
the name of the integer where the number of characters is stored...thanks...But I don't get what you mean...should I create an array with this amount of characters in it? So if this returns 15 characters read, do I create an array with 16 spots in it to run into the program, then use client.read() with this variable and the name of the array into in to fill the array with the text, right? Just want to make sure I got you.
I must have messed that up, because I get this error:
AdvServer_ino.ino:7:16: error: empty character constant
AdvServer_ino.ino: In function 'void loop()':
AdvServer_ino:25: error: virtual outside class declaration
AdvServer_ino:26: error: pointer to a function used in arithmetic
AdvServer_ino:26: error: size of array 'Packet' has non-integral type 'int (*)(uint8_t*, size_t)'
AdvServer_ino:27: error: invalid conversion from 'char*' to 'uint8_t*'
AdvServer_ino:27: error: initializing argument 1 of 'virtual int EthernetClient::read(uint8_t*, size_t)'
AdvServer_ino:27: error: invalid conversion from 'int (*)(uint8_t*, size_t)' to 'size_t'
AdvServer_ino:27: error: initializing argument 2 of 'virtual int EthernetClient::read(uint8_t*, size_t)'
AdvServer_ino:38: error: 'doc' was not declared in this scope
So this automatically returns the amount of characters in client.read()?
Yes, and no. client.available() tells you how many characters are available to be read. client.read() returns the number of characters actually read.
I must have messed that up
By not posting the code...