write_memory.cpp
Go to the documentation of this file.
1 #include "prosilica/prosilica.h"
2 #include <cstdio>
3 #include <cassert>
4 
5 int main(int argc, char** argv)
6 {
7  if (argc < 3) {
8  printf("Usage: %s <IP address> <file>\n", argv[0]);
9  return 0;
10  }
11 
13  FILE* file = fopen(argv[2], "rb");
14  assert(file);
15  fseek(file, 0, SEEK_END);
16  size_t size = ftell(file);
18  printf("File is too big!\n");
19  return -1;
20  }
21  fseek(file, 0, SEEK_SET);
22  size_t items_read = fread(buffer, 1, size, file);
23  fclose(file);
24 
25  if (items_read != size)
26  {
27  printf("An error occurred reading the file\n");
28  return -1;
29  }
30 
32 
33  // Make sure cam's destructor is called before fini
34  {
35  prosilica::Camera cam(argv[1]);
36  cam.writeUserMemory(buffer, size);
37  }
38 
40 
41  return 0;
42 }
int main(int argc, char **argv)
Definition: write_memory.cpp:5
void init()
Definition: prosilica.cpp:88
static const size_t USER_MEMORY_SIZE
Data must have size <= USER_MEMORY_SIZE bytes.
Definition: prosilica.h:171
void fini()
Definition: prosilica.cpp:93
void writeUserMemory(const char *data, size_t size)
Definition: prosilica.cpp:538


prosilica_camera
Author(s): Maintained by William Woodall - wwoodall@willowgarage.com, Contributions by Allison Thackston - allison.thackston@nasa.gov
autogenerated on Mon Jun 10 2019 14:20:19