|
本帖最后由 wyz365889 于 2012-3-6 11:00 编辑
我的解决办法:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
int main()
{
/*int fd;
fd = open("/sddisk/tmpfile",O_RDWR|O_CREAT);
if(fd==-1)
{
printf("Read sdcard failure!");
}
else
{
printf("Read sdcard success!");
}*/
char ch[10];
char cc ;
char szBuff[256];
short int i = 0;
short int j = 0;
FILE *fp;
system("ls /dev/>/tmp/a.txt");
fp = fopen("/tmp/a.txt", "r");
while( !feof( fp ))
{
memset( szBuff, 0, 256 );
fgets( szBuff, 256, fp );
if(NULL != strstr(szBuff,"mmcblk")){
printf("Read sdcard success!\n");
break;
}
}
fclose(fp);
system("rm /tmp/a.txt");
return 1;
}
|
|