User guide

The customizing of the error messages are optional. If not done the PowerSoftware will just add
the integer error code to the log list.
Example (Std. parameter):
The example program shows how to access SD/MMCcards using standard file I/O functions. The
first command line parameter is the CID and the second command line parameter is the logical
drive letter. The CID is then written to the text file CID.BIN on the card.
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
int main(int argc, char* argv[])
{
char cDriveLetter
char strFilename[256];
FILE* pFile;
int iReturnCode = 0;
if (argc == 2)
{
// Please notice: argv[1] = drive letter und argv[0] = CID
// Create the file name
cDriveLetter = argv[1][0];
sprintf(strFilename,"%c:\\CID.BIN",cDriveLetter);
pFile = fopen(strFilename,"w+");
if(pFile == NULL)
{
iReturnCode = 2;
}
else // if(pFile == NULL)
{
// Write the CID or serial number
if(strlen(argv[0]) != fwrite(argv[0],1,strlen(argv[0]),pFile))
{
iReturnCode = 3;
};
fclose(pFile);
}
}
else // if (argc == 2)
{
iReturnCode = 1;
}
return iReturnCode;
}
57/61