|
You can use of CFile class for read and write.
|
|
|
|
|
Thanks Hamid,
i think this is inbuild class but i want to do this by code just like...
1. create a text file
2.Open the file in read/write mode
3.append the text/write the text
4.close the file
thanks alot guys for help
vikas
|
|
|
|
|
tasumisra wrote: i think this is inbuild class
What ?
You can perfectly use CFile in your code, what's the problem ? Just look in MSDN how to use the class.
|
|
|
|
|
i dont want to use
class CFile : public CObject
BECAUSE
i am writing a COM component in that i need to put some log
so there i cant use CFILE may be it can be used there but i dont know..
so please help me in this context
Thanks...
vikas
|
|
|
|
|
Use a std::ofstream instead.
#include <fstream><br />
using namespace std;<br />
<br />
...<br />
...<br />
<br />
<br />
ofstream MyFile("Output.txt");<br />
MyFile << "Hello World" << endl;
|
|
|
|
|
Thanks for your help i ll check it..
vikas
|
|
|
|
|
use these win32 API's CreateFile,WriteFile
dlfkgj lsdfkglfkgjlfgl jldfk fldkk jk
|
|
|
|
|
tasumisra wrote: i am writing a COM component...
Which is an advanced topic. If writing to a text file is troubling you, COM will be next to impossible.
tasumisra wrote: ...may be it can be used there...
Certainly it can, but that's irrelevant at this point.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: COM will be next to impossible
NO BODY is there who knows COM BY BIRTH .... here only everybody had learnt and me too... will prove it...
vikas
|
|
|
|
|
tasumisra wrote: will prove it...
Good luck.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What about FILE and fopen ?
|
|
|
|
|
hi
i am developing a application in server and client on MFC.
when i execute server and client ,Buffer over run error occur in client side .
it will be greatful if i get answer
k.guru moorthy
|
|
|
|
|
guru moorthy.k wrote: it will be greatful if i get answer
Hence try to post a question.
BTW:
guru moorthy.k wrote: i am developing a application in server and client on MFC.
when i execute server and client ,Buffer over run error occur in client side .
The above scenario is too broad to get any help (at least from me ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
guru moorthy.k wrote: it will be greatful if i get answer
The answer is: don't overrun the buffer. Problem solved.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is there any way to open a file in Windows using ONLY the FRN (File Reference Number)?
This is for a file system that does NOT support change journal, but it does support FRN. I need to be able to open the file only using the FRN, and I'm looking for a Windows API that would allow me to do that.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
I don't think the API is going to help you as it deals only with handles (obfuscated pointers to Kernel objects generally). The C Runtime on the other hand does have an indexed table of IO streams which can potentiallly be referenced by number. If I were you that's where I would look but anything like that is going to be a 'hack' so I can't recommend it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I found a solution.
IoCreateFile, with flag FILE_OPEN_BY_FILE_ID
http://msdn2.microsoft.com/en-us/library/aa490578.aspx
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
HI,
Im reading one text file as follow
while((ar.ReadString(strOneLine)) && (strOneLine!=""))
{
..}
My file is verylong..I mean my first line itself very long...it contains morethan 5oo chracters.
strOneLIne shows only half of the text.
Is there any restrictions for reading string thru CArchive ReadString()...Is there any other solution to read full text?
Note: In that text i didnot include any "Enter" just i have only space between two words.
Anu
|
|
|
|
|
Anu_Bala wrote: strOneLIne shows only half of the text.
How do you check that ?
|
|
|
|
|
I get that from Watch window...I used breakpoint and i checked that Stroneline.
Anu
|
|
|
|
|
How do you know that the watch window can display such long strings ? Did you verify first ?
To be sure, just print the string to a file or to the console.
|
|
|
|
|
Anu_Bala wrote: Note: In that text i didnot include any "Enter" just i have only space between two words.
Check better.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I checked.
Im sure...
"1.Remove the tick in " Folder Options\View\Use simple file sharing2.Remove the tick in " Folder Options\View\Use simple file sharing3.Remove the tick in " Folder Options\View\Use simple file sharing4.Remove the tick in " Folder Options\View\Use simple file sharing5.Remove the tick in " Folder Options\View\Use simple file sharing"
This is text in my .Txt file
But Stroneline reads "1.Remove the tick in " Folder Options\View\Use simple file sharing2.Remove the tick in " Folder Options\View\Use simple file sharing3.Remove the tick in " Folder Options\View\Use simple file sharing4.Remove the tick in " Folder Options\View\Use simple "
Where is the balance?
Anu
|
|
|
|
|
As I recall, the watch window only displays the first 256 characters of a CString. Try showing the result in a messagebox and see if you actually read the entire test you intended to read.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I have two files, I do not know on which platform are they. I need to use these files into my project. I think those two files are from c and c++ platfrom . how can i implement those files into my project?
|
|
|
|