Revision: 1135
http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1135&view=rev
Author: warnes
Date: 2007-08-11 16:48:34 -0700 (Sat, 11 Aug 2007)
Log Message:
-----------
Explicitly check file header
Modified Paths:
--------------
trunk/SASxport/R/read.xport.R
Modified: trunk/SASxport/R/read.xport.R
===================================================================
--- trunk/SASxport/R/read.xport.R 2007-08-11 00:03:52 UTC (rev 1134)
+++ trunk/SASxport/R/read.xport.R 2007-08-11 23:48:34 UTC (rev 1135)
@@ -36,6 +36,13 @@
file <- tf
}
+ scat("Checking if the specified file has the appropriate header")
+ xport.file.header <- "HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000 "
+ file.header <- readBin( file, what=character(0), n=1, size=nchar(xport.file.header) )
+ file.header <- substr(file.header, start=1, stop=nchar(xport.file.header) )
+ if( !identical(xport.file.header, file.header) )
+ stop("The specified file does not start with a SAS xport file header!")
+
scat("Extracting data file information...")
dsinfo <- foreign:::lookup.xport(file)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|