eranga262154 22 Junior Poster

Anyway thanks for all your guys replay. I've correct my mistake. Used a null-terminated string, and on that I can use adVarChar variable type without any issue.

Sulley's Boo commented: all the best =D +4
eranga262154 22 Junior Poster

Hi all,

I have just start to work on C++.

I want to open a text file, then write few text there. This is the code I wrote for that.

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	ofstream file;
	file.open ("example.txt");

	if(file.is_open())
		{
			file << "Write a text line";
            		file.close();
		}
	else
		{
			file << "Unable to wirte text";
		}
	return 0;
}

When I compile it gives the following error.

Compiling...
rbf.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Debug/ReadFile.exe : fatal error LNK1120: 1 unresolved externals

What's wrong there. Can you guys help me to solve it.

Ancient Dragon commented: Thanks for using code tags +18