HAL_Init(); // Initialize the USB peripheral and device stack MX_USB_DEVICE_Init(); char lineBuffer1[256]; char lineBuffer2[256]; char lineBuffer3[256]; char lineBuffer4[256]; char lineBuffer5[256]; // Read the second line and send it to functionNumber1 result1 = ReadLineFromFile("C:/Users/Zoundgalaxy/Desktop/functionList.txt", 2, lineBuffer1, sizeof(lineBuffer1)); if (result1 == 0) { USBD_LL_PrepareReceive(&hUsbDeviceFS, EP1_IN, lineBuffer1, sizeof(lineBuffer1)); USBD_LL_Transmit(&hUsbDeviceFS, EP1_OUT, NULL, 0); } else if (result1 == -1) { // Handle the error } else if (result1 == -2) { // Handle the error } // Read the 4th line and send it to functionNumber2 result2 = ReadLineFromFile("C:/Users/Zoundgalaxy/Desktop/functionList.txt", 4, lineBuffer2, sizeof(lineBuffer2)); if (result2 == 0) { USBD_LL_PrepareReceive(&hUsbDeviceFS, EP1_IN, lineBuffer2, sizeof(lineBuffer2)); USBD_LL_Transmit(&hUsbDeviceFS, EP1_OUT, NULL, 0); } else if (result2 == -1) { // Handle the error } else if (result2 == -2) { // Handle the error } // Read the 6th line and send it to functionNumber3 result3 = ReadLineFromFile("C:/Users/Zoundgalaxy/Desktop/functionList.txt", 6, lineBuffer3, sizeof(lineBuffer3)); if (result3 == 0) { USBD_LL_PrepareReceive(&hUsbDeviceFS, EP1_IN, lineBuffer3, sizeof(lineBuffer3)); USBD_LL_Transmit(&hUsbDeviceFS, EP1_OUT, NULL, 0); } else if (result3 == -1) { // Handle the error } else if (result3 == -2) { // Handle the error } // Read the 8th line and send it to functionNumber4 result4 = ReadLineFromFile("C:/Users/Zoundgalaxy/Desktop/functionList.txt", 8, lineBuffer4, sizeof(lineBuffer4)); if (result4 == 0) { USBD_LL_PrepareReceive(&hUsbDeviceFS, EP1_IN, lineBuffer4, sizeof(lineBuffer4)); USBD_LL_Transmit(&hUsbDeviceFS, EP1_OUT, NULL, 0); } else if (result4 == -1) { // Handle the error } else if (result4 == -2) { // Handle the error } // Read the 10th line and send it to functionNumber5 result5 = ReadLineFromFile("C:/Users/Zoundgalaxy/Desktop/functionList.txt", 10, lineBuffer5, sizeof(lineBuffer5)); if (result5 == 0) { USBD_LL_PrepareReceive(&hUsbDeviceFS, EP1_IN, lineBuffer5, sizeof(lineBuffer5)); USBD_LL_Transmit(&hUsbDeviceFS, EP1_OUT, NULL, 0); } else if (result5 == -1) { // Handle the error } else if (result5 == -2) { // Handle the error } string str1 = lineBuffer1; string str2 = lineBuffer2; string str3 = lineBuffer3; string str4 = lineBuffer4; string str5 = lineBuffer5; int intValue1 = stoi(str1); int intValue2 = stoi(str2); int intValue3 = stoi(str3); int intValue4 = stoi(str4); int intValue5 = stoi(str5); int functionNumber1 = intValue1; int functionNumber2 = intValue2; int functionNumber3 = intValue3; int functionNumber4 = intValue4; int functionNumber5 = intValue5; switch (functionNumber1){ case 1: case1(); break; case 2: case2(); break; case 3: case3(); break; case 4: case4(); break; case 5: case5(); break; default: cout << "bad function \n"; break; } switch (functionNumber2) { case 1: case1(); break; case 2: case2(); break; case 3: case3(); break; case 4: case4(); break; case 5: case5(); break; default: cout << "bad function \n"; break; } switch (functionNumber3) { case 1: case1(); break; case 2: case2(); break; case 3: case3(); break; case 4: case4(); break; case 5: case5(); break; default: cout << "bad function \n"; break; } switch (functionNumber4) { case 1: case1(); break; case 2: case2(); break; case 3: case3(); break; case 4: case4(); break; case 5: case5(); break; default: cout << "bad function \n"; break; } switch (functionNumber5) { case 1: case1(); break; case 2: case2(); break; case 3: case3(); break; case 4: case4(); break; case 5: case5(); break; default: cout << "bad function \n"; break; }