CAPL Script

Get First CANdb File Name

This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.

Syntax

dword getFirstCANdbFilename( char buffer[], dword size);

Function

Finds out the file name of the first assigned database.

Parameters

buffer Buffer in which the database file name is written.

size

Size of the buffer in Byte.

Return Values

If successful unequal 0, otherwise 0.

on start  {
  char buffer[256];
  dword pos;
  pos = GetFirstCANdbFilename(buffer, elcount(buffer));
  while (pos != 0)  {
    write("CANdb: %s", buffer);
    pos = GetNextCANdbFilename(pos, buffer, elcount(buffer));
  }
}
on key '3'  {
  char buffer[256];
  dword pos;
  // Position 2 is the predecessor of the requested third database.
  pos = GetNextCANdbFilename(2, buffer, elcount(buffer));
  if (pos != 0) write("Database %u: %s", pos, buffer);
  else write("Third database was not found");
}

Related reference: getFirstCANdbName | getNextCANdbFilename