16,017,788 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by aparna27786 (Top 2 by date)
aparna27786
9-Dec-14 6:02am
View
Deleted
This is a header file please convert into C
there are include some files like
#include <string>
#include <iostream>
#include <fstream>
#include <strstream>
#include <string>
#include <sstream>
aparna27786
9-Dec-14 6:00am
View
Deleted
Please convert this C++ code into C
#ifndef _TSTDLIBS_H
#define _TSTDLIBS_H
// C++ Includes
#include <string>
#include <iostream>
#include <fstream>
#include <strstream>
#include <string>
#include <sstream>
//using namespace std;
pleaseeeeeeeeeeeeeee convert itttttttttttt
#ifdef _WIN32
#include <tchar.h> // For _T() macro!
#else // Non Windows Platform!
#ifdef _UNICODE
typedef wchar_t TCHAR;
#ifndef _T
#define _T(s) L##s
#endif
#ifndef _TSTR
#define _TSTR(s) L##s
#endif
#else
typedef wchar_t TCHAR;
#ifndef _T
#define _T(s) s
#endif
#ifndef _TSTR
#define _TSTR(s) s
#endif
#endif
#endif
namespace tstd
{
#ifdef _UNICODE
typedef std::wstring tstring;
typedef std::wostream tostream;
typedef std::wistream tistream;
typedef std::wiostream tiostream;
typedef std::wistringstream tistringstream;
typedef std::wostringstream tostringstream;
typedef std::wstringstream tstringstream;
typedef std::wifstream tifstream;
typedef std::wofstream tofstream;
typedef std::wfstream tfstream;
typedef std::wfilebuf tfilebuf;
typedef std::wios tios;
typedef std::wstreambuf tstreambuf;
typedef std::wstreampos tstreampos;
typedef std::wstringbuf tstringbuf;
// declare an unnamed namespace as a superior alternative to the use of global static variable declarations.
namespace
{
tostream& tcout = std::wcout;
tostream& tcerr = std::wcerr;
tostream& tclog = std::wclog;
tistream& tcin = std::wcin;
std::wostream& tendl( std::wostream& output )
{
output << std::endl;
return output;
}
tstring wstr_to_tstr(const std::wstring& arg)
{
return arg;
}
tstring str_to_tstr(const std::string& arg)
{
tstring res(arg.length(), L'\0');
mbstowcs(const_cast<wchar_t*>(res.data()), arg.c_str(), arg.length());
return res;
}
std::wstring tstr_to_wstr(const tstring& arg)
{
return arg;
}
std::string tstr_to_str(const tstring& arg)
{
std::string res(arg.length(), '\0');
wcstombs(const_cast<char*>(res.data()), arg.c_str(), arg.length());
return res;
}
}
#else
typedef std::string tstring;
typedef std::ostream tostream;
typedef std::istream tistream;
typedef std::iostream tiostream;
typedef std::istringstream tistringstream;
typedef std::ostringstream tostringstream;
typedef std::stringstream tstringstream;
typedef std::ifstream tifstream;
typedef std::ofstream tofstream;
typedef std::fstream tfstream;
typedef std::filebuf tfilebuf;
typedef std::ios tios;
typedef std::streambuf tstreambuf;
typedef std::streampos tstreampos;
typedef std::stringbuf tstringbuf;
// declare an unnamed namespace as a superior alternative to the use of global static variable declarations.
namespace
{
tostream& tcout = std::cout;
tostream& tcerr = std::cerr;
tostream& tclog = std::clog;
tistream& tcin = std::cin;
std::ostream& tendl( std::ostream& output )
{
output << std::endl;
return output;
}
tstring wstr_to_tstr(const std::wstring& arg)
{
tstring res( arg.length(), '\0' );
wcstombs( const_cast<char*>(res.data()) , arg.c_str(), arg.length());
return res;
}
tstring str_to_tstr(const std::string& arg)
{
return arg;
}
std::wstring tstr_to_wstr(const tstring& arg)
{
std::wstring res(arg.length(), L'\0');
mbstowcs(const_cast<wchar_t*>(res.data()), arg.c_str(), arg.length());
return res;
}
std::string tstr_to_str(const tstring& arg)
{
return arg;
}
}
#endif
}
#endif