Arrays to strings another problem requiring help

HI, another issue now, im using the VDIP USB device to write to a USB drive.
Im collecting data from another part of the program using
float PosRead[20] and float Reading[20] variables.
im then concating this info to USBtx which is then sent to the function USBwrite (String USBtx)
I now people dont like strings on here but im still learning and this is the only way i can get this info into the USB stick as far as i know.
the code is running and im getting this info back from the serial port
Serial No. 63214563
0 0.00 639.00
1 4.96 639.00
2 9.93 639.00
3 15.02 639.00
4 19.98 639.00
5 25.07 639.00
6 29.91 639.00
7 35.00 639.00
8 40.09 639.00
9 45.06 639.00
10 49.90 639.00
11 54.99 639.00
12 59.95 639.00
13 65.04 639.00
14 70.01 639.00
15 75.10 639.00
16 79.94 639.00
17 84.91 639.00
18 90.00 639.00

The above is array position , Posread, Reading

63214563,0.00,639.00,4.96,639.00,9.93,639.00,15.02,639.00,19.98,639.00,25.07,639.00,29.91,639.00,35.00,639.00,40.09,639.00,45.06,639.00,49.90,639.00,54.99,639.00,59.95,639.00,65.04,639.00,70.01,639.00,75.10,639.00,79.94,639.00,84.91,639.00,90.00,639.00
this iswhat i get from the Serial.println(USBtx) using the code supplied below.

6 is what is returned when i use the last line Serial.println(sizeof(USBtx);
this doesn't seem right, i tried using the dtostrf(Reading[k],6,2,temp) with char temp[6] in a for next loop of k ( k was 19) to convert the float info to strings the concat them to USB but it stopped after 3 lines
e.g
63214563,0.00,639.00,4.96,639.00,9.93,639.00
what am i doing wrong? :blush:
as i said before im a noobie still.

//**************************** Convert dat to string for usb
void USBconv(int x) {
  Serial.println("converting!");
  
  Serial.println(x);
  
  Serial.print("Serial No. ");
  Serial.println(serialNo);
  USBtx += serialNo;
  for (int k = 0; k < x; k++) {
    Serial.print(k);
    Serial.print(" ");
    Serial.print(PosRead[k]);
    Serial.print(" ");
    Serial.println(Reading[k]);
    USBtx += ",";
    USBtx += PosRead[k];
    USBtx += ",";
    USBtx += Reading[k];
  }
  USBwrite(USBtx);
  Serial.println(USBtx);
  Serial.println(sizeof(USBtx));
}


//******************************usb

void USBwrite(String USBtx) {

  int NumBytes = (sizeof(USBtx));

  Serial1.print("OPW ");        // open file of if not create file
  Serial1.print(serialNo);
  Serial1.print(".csv");
  Serial1.print(" ");
  Serial1.print(USBdate, HEX); // set file date
  Serial1.print("\r");
  delay(100);
  Serial1.print("WRF ");        // write data to file angle,pressure, for csv formating
  Serial1.print(NumBytes);
  Serial1.print(USBtx);
  Serial1.print("\r");
  delay(100);
  Serial1.print("CLF ");      // close file
  Serial1.print(serialNo);
  Serial1.print(".csv");
  Serial1.print("\r");
  delay(100);
}
int NumBytes = (sizeof(USBtx));

Will always be 7, I think.

Please post all your code.

Sorry there's over 1500 lines of code, and i cant publish some of it work rules.
This is the final stage of the project. Ive had the usb working with straight forward strings. But i cant work out how to convert the float arrray to a string.
im getting the data across fine just trying to work out how to convert it for the VDIP.

could you explain why

Code:
int NumBytes = (sizeof(USBtx));
Will always be 7, I think.

please?

What type is USBtx even supposed to be ?

What type is USBtx even supposed to be ?

valid point , my error, its a String variable.

im trying to get the float arrays into the string as i need to send a string to the VDIP.

im trying to get the float arrays into the string as i need to send a string to the VDIP.

string != String.

If you can't even get that straight, I have no hope for you ever getting your code to work.

could you explain why
Quote
Code:
int NumBytes = (sizeof(USBtx));
Will always be 7, I think.
please?

Sure.
From "WString.h", towards the end of "class String"

protected:
	char *buffer;	        // the actual char array
	unsigned int capacity;  // the array length minus one (for the '\0')
	unsigned int len;       // the String length (not counting the '\0')
	unsigned char flags;    // unused, for future features

If you can't even get that straight, I have no hope for you ever getting your code to work.

this is exactly why i hate posting to these forums, just because you people think you know it all.
Obviously i cant code! Strange i thought i was again asking for help.

Obviously i wasn't born a programmer, my head wasn't inserted into my arse!
I can't be bothered asking genuine questions to be answered by some sarcastic answer.
Thanks for nothing!
]:smiley:

I can't be bothered asking genuine questions

or posting all your code, it seems.

try reading what i put , i cant publish all the code due to company policy.

or posting all your code, it seems.

That's your problem; don't make it ours.