Thread: Variadic function

  1. #16
    Registered User
    Join Date
    Feb 2011
    Now come on, Tater, you're making fun of me.

  2. #17
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    There is something called a format string attack, but printf("%s", something); prevents it so percents or anything else aren't really a problem.

    That being said, I would think that the only reason printf would fail, being used normally, is if stdout was never opened. And in general, I would depend on ferror() and perror() actually get useful information about what went wrong with a stream operation, rather than just a number.

    You probably want to create a temporary new file, remove the old one, and then rename the new file the same as the old one. That way if something does go wrong while dumping the original file is unchanged.

  3. #18
    Registered User
    Join Date
    Nov 2010
    Long Beach, CA
    Quote Originally Posted by Richardcavell View Post
    You sure? I think safeprint is safe for strings that include %s.

    Yeah, you're right. I misread your implementation of safeprint.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  3. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM

Tags for this Thread