There is a good tutorial http://www.gdal.org/ogr_apitut.html
It's written in 3 languages : C, C++ and python (near the bottom)
How to intersect? you get both geometries (OGRgeometry) which you can make from WKT which is easy to write then use OGRGeometry::Intersection to calculate the bit that's inside then cast that to OGRlinestring and call get_length().
When you call get_length() it will return the length in the units that the geometry is in, which given lat/lon points will be in DD (decimal degrees) which is a length, but not particularly useful, to get a length in metres you will need to project the intersection result into a suitable projected coordinate system; projected coordinate systems will have a defined limit of what part of the earth they cover and you can go slightly outside but not too far - the further outside you go the more the shape distorts. A good system is UTM (universe transverse mercator) - note the pictures.
UTM is broken up into zones that are 6 degrees wide (quite a long way, but it is possible when using state sized data to cross more than one), to find out which one to use pick a point on the line (middle would be best) and compare it to the East-West extents of the UTM zones. To project you need to set the known spatial reference (from the GPS) which will most likely be WGS84 (EPSG:4326) using OGRgeometry::assignSpatialReference and then perform the projection using OGRgeometry::transformTo supplying the projected coordinate system.
To create a spatial reference (OGRspatialReference) I would use initFromEPSG as the EPSG codes are easy to calculate... WGS84 Geographic is 4326, UTM (North of the Equator) is 32600 + zone id (UTM 30N is 32630), if you're south of the Equator UTM is 32700 + zone id (UTM 56S is 32756).
If you must have the length in other units (feet, miles, inches, cubits..) then use a scale factor on the determined length in metres... don't go looking for a projected coordinate system with units of feet, miles, inches.. there probably wont be one and there's a possibility that the EPSG code wouldn't be recognized if you did.
Alternately you can use a conic or equal-area projection to cover all of the likely area without too much distortion. Projections exist for Continental United States that covers all the states (except Alaska sometimes and not Hawaii - but you wouldn't be driving out there anyway) which is a catch-all situation. The difference between the methods is likely to be only a few percent and neither takes into account terrain (traversed distance).
Some information on map projections that might help explain what I'm talking about and help decide which to use.
If you are using OGR libraries it's usual to open a layer (covered in the tutorial) and then iterate through the features (OGRfeature) and get their geometries using GetGeometryRef, as for the GPS log it need not exist and may be created in memory using the importFromWKT call.