EasyManuals Logo

HP 16500C Programmer's Guide

HP 16500C
252 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #63 background imageLoading...
Page #63 background image
Example The following example in C opens the \system\program file and sends
several commands and queries. Responses to queries appear as text strings
in
\system\program. The HP 16500C has been NFS-mounted in the \users
directory.
#include <stdio.h>
#include <unistd.h>
#define STR_LEN 80
void putstr(FILE *file, char *str)
{
fwrite(str, strlen(str), 1, file);
}
int getstr(FILE *file, char* str)
{
return(fread(str, 1, STR_LEN, file));
}
void main()
{
FILE *file;
int num;
char receive_str[STR_LEN];
/* Send a query and retrieve and print the response*/
file = fopen("/users/system/program", "r");
while (getstr(file, receive_str) != 0);
fclose(file);
file = fopen("/users/system/program", "w");
putstr(file, "*idn?\n");
fclose(file);
sleep(1);
file = fopen("/users/system/program", "r");
while (getstr(file, receive_str) == 0);
fclose(file);
printf("%s\n", receive_str);
Programming Over LAN
Writing to \system\program from a Program
4–9

Table of Contents

Other manuals for HP 16500C

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 16500C and is the answer not in the manual?

HP 16500C Specifications

General IconGeneral
BrandHP
Model16500C
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals