Configuring VS2008 C++ to C

This is a discussion on Configuring VS2008 C++ to C within the C Programming forums, part of the General Programming Boards category; Well, I've gotten a C thing to do, now I'm used to C++, and don't know what I can do ...

  1. #1
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717

    Configuring VS2008 C++ to C

    Well, I've gotten a C thing to do, now I'm used to C++, and don't know what I can do in C++, which I can't do in C, so how to i make VS2008 C++ check for C errors and such stuff?
    Currently research OpenGL

  2. #2
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    Just name your source files with .c, instead of .cpp, and VC++ will compile it as a C program.
    OS: Linux Mint 13(Maya) LTS 64 bit.

  3. #3
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Yeah, I tried that
    C is complicated D: move on to C++, I say!
    Currently research OpenGL

  4. #4
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    So when you try to build your .c file, what error messages do you get?
    OS: Linux Mint 13(Maya) LTS 64 bit.

  5. #5
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    oh it worked
    just that C has other complicated stuff, that C++ doesn't xP
    Well, I wanna ask what stuff like '%2.2f' does o.O?
    Currently research OpenGL

  6. #6
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Ok, I think I figured it out, when used in printf, it sets how many numbers and decimals, correct?
    Currently research OpenGL

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Yep.

    I thought you said it was difficult? How come you're guessing it all right then?

  8. #8
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Well, 'cause I looked at the output and the numbers, and saw that they had something in common xP
    But I do very well notice that C++ is easier
    Currently research OpenGL

  9. #9
    The larch
    Join Date
    May 2006
    Posts
    3,573
    '%2.2f'
    This is not something specific to C. Format strings are probably the most convenient ways to describe complex formatting and exist in other languages too. Think how you'd need to chain complex manipulators with cout to achieve the same simple effect.

    Also extremely useful when internationalizing programs: fragments of sentences as cout takes them may not be translateable, whereas format strings with place-holders for numeric values are. Although here positional arguments might be even better (not possible with C printf I think): e.g "Copied %1 files from %2" - the values of %1 and %2 might not naturally come in the same order in a foreign language but you'd be able to write: "ZZZ %2 djhs: %1"

    printf is available in C++ (although it is often not recommended because of type unsafety - a variadic function works on arguments without really knowing their type beyond what the coder says in the format string). In a type-safe way it is also available as boost::format.

    Format strings are recommended learning, I think.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C->Cdll->C#dll under VS2008
    By Opariti in forum C Programming
    Replies: 2
    Last Post: 01-27-2009, 03:53 AM
  2. MASM In VS2008
    By valaris in forum Tech Board
    Replies: 1
    Last Post: 01-13-2009, 08:11 PM
  3. Need VS2008 Verification
    By rags_to_riches in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2008, 04:51 AM
  4. Does VS2008 have anything like Pythons IDLE?
    By atomsmasher442 in forum C# Programming
    Replies: 1
    Last Post: 07-26-2008, 04:37 AM
  5. Configuring VPN
    By ssharish2005 in forum Tech Board
    Replies: 5
    Last Post: 12-26-2006, 10:57 PM

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