View Single Post
  #2 (permalink)  
Old 12-14-2007, 06:05 PM
Thomas
Guest
 
Posts: n/a
Default Re: using fstream to access File on Compact Flash Card

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:
> 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 <stdio.h> 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;i<4;i++){
> myrun(mainbuf);
> pbuf->sputc( (char *) mainbuf);
> usleep(1000);
> }
> return 0;
> }
>
> System hangs at this point.........
>
> Please do let me know how file from CF card ->input stream?
>
> Priyantha
>
>



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