mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-02-27 20:26:37 +00:00
nfc_device_get_information_about() now allocates returned string.
Note: must be freed by free().
This commit is contained in:
@@ -104,14 +104,15 @@ main(int argc, const char *argv[])
|
||||
}
|
||||
|
||||
printf("%d NFC device(s) found:\n", (int)szDeviceFound);
|
||||
char strinfo[1024];
|
||||
char *strinfo = NULL;
|
||||
for (i = 0; i < szDeviceFound; i++) {
|
||||
pnd = nfc_open(NULL, connstrings[i]);
|
||||
if (pnd != NULL) {
|
||||
printf("- %s:\n %s\n", nfc_device_get_name(pnd), nfc_device_get_connstring(pnd));
|
||||
if (verbose) {
|
||||
if (nfc_device_get_information_about(pnd, strinfo, sizeof(strinfo)) >= 0) {
|
||||
if (nfc_device_get_information_about(pnd, &strinfo) >= 0) {
|
||||
printf("%s", strinfo);
|
||||
free(strinfo);
|
||||
}
|
||||
}
|
||||
nfc_close(pnd);
|
||||
|
||||
Reference in New Issue
Block a user