-
>>i would like to be able to get the actual string back as a normal int
OK, one last attempt on my part at understanding exactly what you are trying to do. martin_00, answer me these:
- What does your input string look like? Give a precise example.
- Do you want to extract data from all of it, or from between two specific points (start/end)?
- What do you mean by returning a "normal int"?
- What exactly do you want to be returned, and how does it relate to the input string?
-
i kind of did give a example of the string. this is just a function i thought might teach me a little more about c. it is basically a excuse to make a library just for the sake of making a library.
the function itself should return the data inbetween to points, the function should return the middle. but since you guys showed me before i was returning a adress i would like to just return the actuall charcaraters.
so know i have to use it like:
strcpy( some_char, copy("pleasefixme", 7, 9);
i would like it to return a int so i could use it like this
printf("%s\n", copy("pleasefixme", 7, 9));
-
Code:
#include <stdio.h>
int returnAnsi(char);
int main(void)
{
char mystring[] = "testing this string";
int code,i;
char letter;
for(i=5; i < 12; i++)
{
letter = mystring[i];
code = returnAnsi(letter);
// do something with code
printf("%c ansi code: %d [string tested]: %s\n", letter, code, mystring);
}
return 0;
}
int returnAnsi(char ansi)
{
return ansi;
}
Find something to do with the returning int and you're set. :D