Thread: C++ to C

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    19

    C++ to C

    I'm really new to c. I can even say it's my first day. I been programming in C++ for about a month or two and decided to start learning C.

    I wanted to know if there are functions like getline or isdigit in c.

    In C++ we have stringstream for conversion from one data type to another. Is it supported on C?? If not, is there a method similar to that???

    I also wanted where i can get tutorials on transition from C++ to C does anyone know where i can find those??

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by tsubasa
    I wanted to know if there are functions like getline or isdigit in c.
    There is fgets; isdigit is C also.

    Quote Originally Posted by tsubasa
    In C++ we have stringstream for conversion from one data type to another. Is it supported on C?? If not, is there a method similar to that???
    No stringstreams in C, there are functions such as strtol, strtod, and sscanf that may be used.

    Quote Originally Posted by tsubasa
    I also wanted where i can get tutorials on transition from C++ to C does anyone know where i can find those??
    I don't know about transitioning, just follow a C tutorial. The stuff you already know will simply be easy.

    Also, you might want to check out the FAQ.
    Last edited by Dave_Sinkula; 05-17-2006 at 11:10 AM.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    silk.odyssey

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    169
    Take heed: you may run into problems with the intermediate assignments
    See: http://cboard.cprogramming.com/showthread.php?t=79177

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I wanted to know if there are functions like getline or isdigit in c.
    If the header file in C++ is something like <cstdlib> then it's just a C header file that used to go by the name <stdlib.h>.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    Another C tutorial. Looks interesting.

    http://www.friedspace.com/CProg.html.
    silk.odyssey

Popular pages Recent additions subscribe to a feed