c - Syntax error near unexpected token '(' when using terminal -
i trying cpuid tablet bricked , have code , when execute on ubuntu via terminal, gives following error: line 5: syntax error near unexpected token '(' line 5: 'int main(void)'
how can resolve issue?
#include <libusb-1.0/libusb.h> #include <stdio.h> #include <stdint.h> int main(void) { unsigned char data[64]; int received_length; int r = 1; libusb_context* ctx = null; libusb_device_handle* dev_handle = null; libusb_init(&ctx); dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x7820); if(dev_handle) { r = libusb_bulk_transfer(dev_handle, 0x81, data, sizeof(data), &received_length, 10000); if (r == 0) { if(received_length == 8) { printf("uid: 0x%08x%08x\n", *((uint32_t*)data+1), *((uint32_t*)data+0)); } else { r = 1; printf("error: got %d bytes of data insetad of 8 bytes expected...\n", received_length); } } else { printf("error: usb read failed!\n"); } libusb_release_interface(dev_handle, 0); } else { printf("error: failed open device!\n"); } libusb_exit(ctx); return r; }
you need compile program , run executable. if program in foo.c, compile with:
gcc foo.c -o foo then execute with:
./foo you can't run c source file directly -- c not scripting language.
Comments
Post a Comment