|  | 
| 
 [C] Incremental string updates - 00001.png 00002.png etc Hi, I am writing a program in C that will be outputting a lot of files that I want to be named 00001.png 00002.png 00003.png and so on. The way I am doing it at the moment is as follows: Code:         for(i=0; i < 10000; i++)Any ideas? Thanks Robbie | 
| 
 You could do something like this: Code: string:filename; | 
| 
 Never mind, was thinking in Java, not C | 
| 
 In C you could do something like this: Code: int num = 0; | 
| 
 My C is a bit rusty but sprintf is your friend here. Try: Code: char buffer[10];I dont have a C compiler anymore so I cant test this but it should be right, google will find you literally hundreds of guides to format strings with printf and sprintf though. Hope this helps | 
| 
 beaten by a minute :) I guess it confirms that the %05d was right though, i wasnt sure :) | 
| 
 Thanks guys. The sprintf() command worked great. | 
| All times are GMT -8. The time now is 12:24 PM. | 
	Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
	
Search Engine Optimization by vBSEO 3.6.0 PL2
	© 2002-2012 Tilted Forum Project