Article ID: 105763
Article Last Modified on 11/21/2006
filename:stream
#include <windows.h>
#include <stdio.h>
void main( )
{
HANDLE hFile, hStream;
DWORD dwRet;
hFile = CreateFile( "testfile",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
0,
NULL );
if( hFile == INVALID_HANDLE_VALUE )
printf( "Cannot open testfile\n" );
else
WriteFile( hFile, "This is testfile", 16, &dwRet, NULL );
hStream = CreateFile( "testfile:stream",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
0,
NULL );
if( hStream == INVALID_HANDLE_VALUE )
printf( "Cannot open testfile:stream\n" );
else
WriteFile(hStream, "This is testfile:stream", 23, &dwRet, NULL);
}
The file size obtained in a directory listing is 16, because you are
looking only at "testfile", and therefore
type testfile
This is testfileHowever
type testfile:stream
The filename syntax is incorrectIn order to view what is in testfile:stream, use:
more < testfile:stream
-or-
mep testfile:stream
Keywords: kbhowto kbapi kbkernbase kbfileio KB105763