This compiler is driving me nuts

This is a discussion on This compiler is driving me nuts within the C Programming forums, part of the General Programming Boards category; >>i would like to be able to get the actual string back as a normal int OK, one last attempt ...

  1. #31
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>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?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  2. #32
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    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));

  3. #33
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    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.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  2. Help With finding a compiler
    By macman in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-15-2005, 09:15 AM
  3. Compiler questions
    By DvdHeijden in forum C++ Programming
    Replies: 6
    Last Post: 01-17-2005, 03:00 PM
  4. Have you ever written a compiler?
    By ammar in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 12-27-2004, 07:10 AM
  5. driving me nuts
    By boontune in forum C++ Programming
    Replies: 3
    Last Post: 10-07-2002, 05:35 AM

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