using fstream to access File on Compact Flash Card

Specification EDK version:8.2i FPGA Board: Virtex II Pro Compiler : mb-g++

I'm tring to create a file stream using ifstream instr("ba1.bits") or ifstream instr("a:\\ba1.bits") to create a file stream from CF card.

In addition I've added #include which is necessary to ensure that microblaze compiler recognizes the the c++ sections of code.

I've amended the file ....\EDK\sw\lib\sw_services\xilfatfs_v1_00_a \src\include\sysace_stdio.h uncommenting the following lines

#define SYSACE_FILE FILE // typedef void FILE;

#define fopen sysace_fopen #define fclose sysace_fclose #define fread sysace_fread #define fwrite sysace_fwrite

File cannot be read...

Alternatively I tried using sysace_fopen directly -> char array ->

streambuf

streambuf * pbuf;

void myrun(void * mybuf) { sysace_fread( (void *) mybuf, 1, 1, outfile); // pbuf->sputn (charbuffin,sizeof(charbuffin)-1); }

Int main (){ void *mainbuf;

if ((outfile = sysace_fopen("file.txt", "r")) == NULL) { xil_printf("Couldn't open the file\r\n"); } else{

for (int i=0;isputc( (char *) mainbuf); usleep(1000); } return 0; }

System hangs at this point.........

Please do let me know how file from CF card ->input stream?

Priyantha

Reply to
Bathala
Loading thread data ...

Hi Priyantha -

Try replacing "file.txt" with "a:\\file.txt". To the standalone OS, the CF drive looks like the "a:\" drive.

Thomas Werne

Bathala wrote:

--
All personal and professional opinions presented herein are my
own and do not, in any way, represent the opinion or policy of JPL
Reply to
Thomas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.