Oh boy, where to start..
First, learn to use code tags, its not difficult.
Give more details on your problem, and show the errors you are getting.
Dont use void main.
Try posting this again, but this time.. properly
and then I will help you with your problem.
What errors are you getting?
Why isn't your code in code-tags?
... or indented for that matter?
You should post this along with your compiler.
You're trying to use cout without #including <iostream>. That won't work I guess.
You're #including <string>, but then using a <char*> instead of a <string>!
On top of that, you're declaring a pointer that's pointing to ANY place in the memory and ordering cin to write the input to that? I think that's what you were trying to do.
I don't know how cin and char* work together, but it's better to make per a <string> instead of a <char*>, so you won't run into memory troubles.
I am just trying to learn thing My self. Sorry for the improper coding standard.
I really don't understand, what you both mean by saying 'code tags'
I am using Borland C++ compiler.
I am trying to enter inputs from keyboard to a file in binary format. I am not getting any error instead, if i enter in keyboard as "sfdahjkllllllllg", it will be written in the ss.txt file as 's“A', now if i enter in keyboard as "asdfgeturit", then in file it will be written as 'a“A'
Let me repost the code again with modifications:-
using namespace std;
ofstream out("ss.txt",ios::app | ios::binary);
cout<<"Enter some character ....\n";
As mention before, per is a pointer that just points to some random memory location. and *per only references the first byte, not the entire string. Unless the purpose of this assignment is to learn character arrays and pointers, then you would be better off using std::string.
Job well done on the program. However, when write is now called multiple times, each time it will allocate 100 bytes of memory to the pointer. This is called a memory leak. To fix that, make sure you only allocate the memory once (call new once).
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...