Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Write and Read from i/o files using WriteFile/ReadFile

Sonx_hvn7Sonx_hvn7 Member Posts: 54
Here's my first attempt to Win32 functions after having used fprintf/fwrite and fscanf/fread...

[code]
//=============================================================================
//RFS Input/Output file Functions - Copyright

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : Here's my first attempt to Win32 functions after having used
    : fprintf/fwrite and fscanf/fread...
    :
    : [code]:
    : //=============================================================================
    : //RFS Input/Output file Functions - Copyright
  • Sonx_hvn7Sonx_hvn7 Member Posts: 54
    : : Here's my first attempt to Win32 functions after having used
    : : fprintf/fwrite and fscanf/fread...
    : :
    : : [code]: :
    : : //=============================================================================
    : : //RFS Input/Output file Functions - Copyright
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]You missed the brackets in IF() statement. First compiler evaluates "==" operation and result of this is 'int'. See RED:[/color]
    [code]
    : : : // Create file for writing
    : : : if ([color=Red]([/color]file_io = CreateFile( lpFileName, access, 0, NULL, fileDiscript,
    : : : FILE_ATTRIBUTE_NORMAL , NULL)[color=Red])[/color] == INVALID_HANDLE_VALUE )
    : : : {
    : : : WriteFile(GetStdHandle(STD_ERROR_HANDLE), "Error openning source", sizeof "Error reading from source", NULL, NULL);
    : : : }
    : : :
    : : : return file_io;
    : : : }
    : : : [/code]
  • Sonx_hvn7Sonx_hvn7 Member Posts: 54
    : [color=Blue]You missed the brackets in IF() statement. First
    : compiler evaluates "==" operation and result of this is 'int'. See
    : RED:[/color]
    : [code]:
    : : : : // Create file for writing
    : : : : if ([color=Red]([/color]file_io = CreateFile( lpFileName, access, 0, NULL, fileDiscript,
    : : : : FILE_ATTRIBUTE_NORMAL , NULL)[color=Red])[/color] == INVALID_HANDLE_VALUE )
    : : : : {
    : : : : WriteFile(GetStdHandle(STD_ERROR_HANDLE), "Error openning source", sizeof "Error reading from source", NULL, NULL);
    : : : : }
    : : : :
    : : : : return file_io;
    : : : : }
    : : : : [/code]:
    :

    Oops!, thnx
Sign In or Register to comment.