Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

int value to ascii.

Posted on 1998-07-29
3
Medium Priority
?
239 Views
Last Modified: 2010-04-15
I am trying to generate a list of numbered filenames something like:
file0.bmp
file1.bmp
file2.bmp
.
.

I am trying to use a for loop on i and I was wondering how to get the value in i converted to ascii.

If you do 'i' it gives you the ascii for i and not the ascii for the value in i (0,1,2,...), so you get:
filei.bmp
filei.bmp
.
.

Seems simple enough,
Jon

Thanks
0
Comment
Question by:klingej
  • 2
3 Comments
 

Author Comment

by:klingej
ID: 1251872
Edited text of question
0
 
LVL 2

Accepted Solution

by:
kellyjj earned 150 total points
ID: 1251873
Here is one way of doing it:

for (i=0;i<SOME_LIMIT;i++)
{
   sprintf(fname,"file%i.bmp",i);
}
0
 
LVL 2

Expert Comment

by:kellyjj
ID: 1251874
then all you would have to do is then open up each file.  
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question