#! perl -slw
use strict;
use Win32::Pipe;
my $pipe = Win32::Pipe->new( 'MyPipe' );
print system 1, 'c:\test\dummyCapp.exe \\\\.\\pipe\\MyPipe' or die $?;
$pipe->Connect;
$pipe->Write( 'The quick brown fox' );
$pipe->Disconnect;
$pipe->Close;
####
#include
int main( int argc, char **argv ) {
FILE *f;
if( argc < 2 ) {
fprintf( stderr, "No filename given\n" );
exit( -1 );
}
if( f = fopen( argv[1], "r" ) ) {
int read = 0;
char pword[ 1024 ];
if( read = fread( pword, sizeof( char ), 1024, f ) ) {
printf( "Got: '%s'\n", pword );
}
else {
fprintf( stderr, "Failed to read anything\n" );
exit( -2 );
}
}
else {
fprintf( stderr, "Couldn't open file %s: %d\n", argv[1], GetLastError() );
exit( -3 );
}
printf( "Ending...\n" );
return 0;
}
##
##
C:\test>junk50
560
Got: 'The quick brown fox'
Ending...