Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

tmpfile() returns a null pointer

Status
Not open for further replies.

my_account

Newbie level 6
Joined
Sep 21, 2011
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
Hi,

I have a C code running on a Xilinx card, equipped with a Microblaze processor.
I have trouble when calling this function:
Code:
tmpfile()
which all the time returns a null pointer.
I don't know how to fix this problem.

Have you any idea about this bug?
thx in advance
 

You're apparently assuming, that a temporary file can be always created. Can you?
 

You're apparently assuming, that a temporary file can be always created. Can you?

All what i can show you is this instruction:
Code:
if (!(input_file = tmpfile())) {
	    print (" Problem with tmpfile \n");
	    goto error;
	}

I always have this error message.
 

#include <stdio.h>

FILE *tmpfile(void);


The tmpfile() function shall create a temporary file and open a corresponding stream. The file shall be automatically deleted when all references to the file are closed. The file is opened as in fopen() for update (w+).

Upon successful completion, tmpfile() shall return a pointer to the stream of the file that is created. Otherwise, it shall return a null pointer [CX] and set errno to indicate the error. ..

Check your file whether it is opening properly or not..Try to use tmpfile() with different files..So that you will come to know about the error why it is returning like that....
 

Check your file whether it is opening properly or not..Try to use tmpfile() with different files..So that you will come to know about the error why it is returning like that....

The variable input_file has been just created before the instruction above:
Code:
FILE *input_file;

I can't see how i can check the file if it's opening properly or not :/
Notice that I am in an embedded plateform..
 

I meant, did you check, if the prerequisites for creating the tempfile file are fulfilled in your system, e.g. sufficient memory.
 

yes, sure, i have tried to increase my memory space.
I have even tried to call this function in a new source file (in a new project), but it's still the same problem.
What i've noticed that the program is blocked in the call of the function itself,
it doesn't return any thing, contrary to what i've mentioned in the title.

So, i, already, wonder if it is allowed to work with FILE* (the type of input_file)
in an embedded platform? :roll:

Do you have any idea about this?
 

So, i, already, wonder if it is allowed to work with FILE* (the type of input_file) in an embedded platform?
Of course it's allowed, if the feature has been implemented in the run time library and respectively configured in your design. The question can only be answered by inspecting the Microblaze RTL manual and your particular application enviroment.
 

Of course it's allowed, if the feature has been implemented in the run time library and respectively configured in your design. The question can only be answered by inspecting the Microblaze RTL manual and your particular application enviroment.

I have to notice that the implementation is already done to run on Computers
(Jasper code for Jpeg2000 compression).
My task is to make this code running on an embedded plateform.

Besides, what i've seen in this thread makes me asking the question of compatibility..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top