mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Examples: C Interactive: Initialize product description to empty string
This is a guard in case the icsneo_describeDevice call were to fail for some reason, and is just good practice regardless.
This commit is contained in:
@@ -31,7 +31,7 @@ void printAllDevices() {
|
||||
printf("No devices found! Please scan for new devices.\n");
|
||||
}
|
||||
for(int i = 0; i < numDevices; i++) {
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
|
||||
// Updates productDescription and descriptionLength for each device
|
||||
@@ -271,7 +271,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -332,7 +332,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -380,7 +380,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -439,7 +439,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -504,7 +504,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -559,7 +559,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
@@ -585,7 +585,7 @@ int main() {
|
||||
selectedDevice = selectDevice();
|
||||
|
||||
// Get the product description for the device
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION] = {};
|
||||
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user