When would tmpfile(); not work?

This is a discussion on When would tmpfile(); not work? within the C Programming forums, part of the General Programming Boards category; A program I have written will be ran on Windows as a normal user. An installer I have created will ...

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    3

    When would tmpfile(); not work?

    A program I have written will be ran on Windows as a normal user. An installer I have created will install it into the C:\Program Files directory. I will need to use tmpfile(); for many things. Is this effective or is there a better method? Would the system deny the program the ability to use tmpfile(); because the program is being ran from that directory? I have used tmpfile(); in a variety of situations and it has never returned NULL for me, and I need it to still be reliable in this situation. What would make it return NULL, and why? Do I have nothing to worry about? Thanks!

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    This is essentially a Windows question.
    tmpfile (CRT)
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    3
    Thank you for the link. I take it I should use something other than tmpfile();, in this case? What if I use tmpnam(); as well to put it in the Application Data directory? Will there be any chances of it returning null after that? I need a 100% success rate. Maybe I should write my own functions for this instead of using tmpfile(); and fgetc(); and the rest of it?

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,657
    First result of Google search of "windows temp file c++". Note that the example, which states that it is C++, is in fact C code.

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    3
    After looking at all of this, I have decided to just store the file in an array and replace all of my fgetc and similar code with functions made to treat the array like a file. Thank you all for contributing, though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tmpfile () limit
    By AndyD in forum C Programming
    Replies: 16
    Last Post: 05-20-2011, 11:02 AM
  2. Why is tmpfile returning my stderr message?
    By steals10304 in forum C Programming
    Replies: 2
    Last Post: 11-07-2009, 03:50 AM
  3. getting SDL to work with Dev-Cpp
    By linucksrox in forum Game Programming
    Replies: 5
    Last Post: 10-24-2005, 12:43 PM
  4. Ramdisk with tmpfile?
    By seedpress in forum Linux Programming
    Replies: 0
    Last Post: 05-10-2005, 09:37 PM
  5. my function doesn't work! it should work
    By Unregistered in forum C Programming
    Replies: 13
    Last Post: 05-02-2002, 03:53 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21