~ubuntu-branches/ubuntu/precise/primrose/precise

« back to all changes in this revision

Viewing changes to minorGems/network/win32/WSABugDemo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Paul Wise
  • Date: 2009-04-06 19:26:56 UTC
  • Revision ID: james.westby@ubuntu.com-20090406192656-cri7503gebyvfl8t
Tags: upstream-5+dfsg1
ImportĀ upstreamĀ versionĀ 5+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <winsock.h>
 
2
#include <windows.h>
 
3
 
 
4
#include <sys/stat.h>
 
5
#include <stdio.h>
 
6
 
 
7
 
 
8
int main() {
 
9
 
 
10
    WORD wVersionRequested;
 
11
    WSADATA wsaData;
 
12
    
 
13
    int err; 
 
14
    wVersionRequested = MAKEWORD( 1, 0 ); 
 
15
    err = WSAStartup( wVersionRequested, &wsaData );
 
16
    
 
17
    if ( err != 0 ) {
 
18
        // no usable DLL found  
 
19
        printf( "WinSock DLL version 1.0 or higher not found.\n" );  
 
20
        
 
21
        return -1;
 
22
        }
 
23
 
 
24
    int error = WSAGetLastError();
 
25
 
 
26
    printf( "WSA Error before stat call = %d\n", error );
 
27
 
 
28
    struct stat fileInfo;
 
29
    int statError = stat( "DoesNotExist", &fileInfo );
 
30
 
 
31
    printf( "stat error = %d\n", statError );
 
32
 
 
33
    error = WSAGetLastError();
 
34
 
 
35
    printf( "WSA Error after stat call = %d\n", error );
 
36
 
 
37
    return 0;
 
38
    }
 
39
 
 
40
 
 
41