If you want to use 7 data bits and even parity then you need to make some changes in SFile.cpp:
Code:
// Change this line
static TCHAR MODESETTINGS[]= _T("baud=%d parity=N data=8 stop=1 ");
// to
static TCHAR MODESETTINGS[]= _T("baud=%d parity=E data=7 stop=1 ");
Here is some simple code that demonstrates how to use SFile.
Code:
#include <windows.h>
#include "SFile.h"
#include <iostream>
using namespace std;
int main()
{
SFile sf;
// open COM1 at 9600, 7E1
if (!sf.Open(1, 9600))
{
cerr << "Failed to open COM1, ec = " << GetLastError() << endl;
return 1;
}//if
// read a byte at a time and display it
// (this should loop forever)
BYTE b;
while (sf.ReadByte(b))
{
cout << (int)b << endl;
}//while
return 0;
}//main
gg