Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5365

ScanFile is skipping zeros

$
0
0

Hi, I've been using this algorithm for some time in CVI 2012, but now in CVI 2013, I have found that ScanFile is not working the same for me.

 

I'm unclear whether this is a CVI 2013 issue, or just a dormant bug that I had never witnessed until now.

 

I'm am scanning through an ASCII tab-delimited log file.  Some "columns" are text, others are numeric. I prefer to scan through the columns in a non-rigid way; i.e., I'm not strictly following the column order as it exists in the log file.  Here's what it looks like:

 

for (i=0; i<LOG_MAX_COLS; i++)
{
	switch (i)
	{
		case LOG_COL_ID:
			ScanFile(fileHandle,"%s>%i[x]",&unitData[slot].id);			
			break;
		case LOG_COL_SERIAL:
			ScanFile(fileHandle,"%s>%s[xt09]",unitData[slot].serial);		// discard tab (ASCII 0d09)
			break;
		case LOG_COL_REVISION:
			ScanFile(fileHandle,"%s>%s[xt09]",unitData[slot].revision);		// discard tab (ASCII 0d09)
			break;
		case LOG_COL_STAGE:
			ScanFile(fileHandle,"%s>%i[x]",&unitData[slot].logStage);
			break;
		case LOG_COL_RETRIES:
			ScanFile(fileHandle,"%s>%i[x]",&unitData[slot].retry);	
			break;
		case LOG_COL_RUNNING:
			ScanFile(fileHandle,"%s>%i[x]",&unitData[slot].running);	
			break;
		case LOG_COL_COMPLETE:
			ScanFile(fileHandle,"%s>%i[x]",&unitData[slot].complete);
			break;
		case LOG_COL_ELAPSED:
			ScanFile(fileHandle,"%s>%s[xt09]",elapsedString);	// discard tab (ASCII 0d09)
			break;
		/* Now fill a placeholder string with the remaining fields so that the file pointer stays in sync.*/
		case LOG_COL_DATE:
		case LOG_COL_TIME:
		case LOG_COL_VOLTAGE:
		case LOG_COL_CURRENT:
		case LOG_COL_STATION:
		case LOG_COL_SOFTWARE:
		case LOG_COL_SLOT:
		case LOG_COL_DESC:
		case LOG_COL_COMMENT:
			ScanFile(fileHandle,"%s>%s[xt09]",tempString);		// discard tab (ASCII 0d09)
			break;
	}

 

The behavior I'm seeing now is if I have any zeros in my log file in the numeric columns, these are getting skipped until a non-zero value is found.  Suggestions?


Viewing all articles
Browse latest Browse all 5365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>