Thread: read string function

  1. #1
    Registered User
    Join Date
    Feb 2010

    read string function


    I want to create a function read() that gets a string from the user and returns a char *

    How can i do it?

    char * read(){
    	char string[101];
    	fgets(string, 100, stdin);
    	return string;
    This way i get an error that i am trying to return a local variable

  2. #2
    Registered User
    Join Date
    Feb 2010
    nevermind.... i found it sorry for this stupid question

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. Unable to compare string with 'getter' returned string.
    By Swerve in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2009, 05:56 PM
  3. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM