summaryrefslogtreecommitdiff
path: root/main.c
blob: 7fc46dc038ff57f95226a8b2a20b841b1782a959 (plain)
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
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

/*--------------------------------------------------- PROTOS
*/

/*--------------------------------------------------- MAIN
*/
int main(int argc, char *argv[])
{
    HANDLE port;
    
    if (argc<2)
    {
        fprintf(stderr,"usage: %s port\n",argv[0]);
        return EXIT_FAILURE;
    }
    
    port=CreateFile(argv[1],GENERIC_READ|GENERIC_WRITE,0,NULL,
                    OPEN_EXISTING,0,NULL);
                    
    if (port==INVALID_HANDLE_VALUE)
    {
        fprintf(stderr,"%s: error %ld opening %s\n",
                                argv[0],GetLastError(),argv[1]);
        return EXIT_FAILURE;
    }
    
    CloseHandle(port);
    
    printf("Done\n");
    
    system("pause");
}