-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilities.cpp
More file actions
80 lines (69 loc) · 1.41 KB
/
Utilities.cpp
File metadata and controls
80 lines (69 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//========================================================================
//
// TITLE: UTILITIES.CPP
//
// FACILITY: Copied from StarryNight SDK Plug-In DLL ASCOM focuser Control
//
// ABSTRACT:
//
// USING:
//
// ENVIRONMENT: Microsoft Windows Windows 95/98/NT/2000/XP
// Developed under Microsoft Visual C++ Version 6.0
//
// AUTHOR: Robert B. Denny
//
// Edit Log:
//
// When Who What
//---------- --- --------------------------------------------------
// 26-Jul-00 rbd Initial edit
// 21-Aug-05 mk Additional Modifications to drvFail
//========================================================================
#include "RemoteControl.h"
#pragma hdrstop
// ---------
// pToCStr() - Convert PString to CString
// ---------
//
void pToCStr(pStr255 p, char *c)
{
DWORD l = (DWORD)p[0];
if(l > 0)
CopyMemory(c, &p[1], l);
c[l] = '\0';
}
char* pToCStr(pStr255 p)
{
DWORD l = (DWORD)p[0];
char* c = new char[l];
if (l > 0)
CopyMemory(c, &p[1], l);
c[l] = '\0';
return c;
}
// ---------
// cToPstr() - Convert CString to PString
// ---------
//
void cToPstr(char *c, pStr255 p)
{
int l = lstrlen(c);
p[0] = (unsigned char)(l & 0xFF);
if(p[0] > 0)
CopyMemory(&p[1], c, l);
}
// ---------
// pStrCmp() - Compare PStrings
// ---------
//
bool pStrCmp(pStr255 s1, pStr255 s2)
{
if(s1[0] != s2[0])
return(false);
for (short i = 1; i <= s1[0]; i++) {
if(s1[i] != s2[i])
return(false);
}
return(true);
}