|
|
I have a file in which I write some names. lets say: Fiat, Ford, BMW. How can I open the file and read the entries one by one. eg: if only want to read Fiat and Ford then read only Fiat and Ford.
|
|
|
|
|
if ur writing this name in seperate lines, u can use
CStdioFile::ReadString()..
nave
|
|
|
|
|
Thanks a lot it works using ReadString(). But how can I edit the file and replace Fiat with Mercedes, let's say?
|
|
|
|
|
tanarnelinistit wrote: how can I edit the file and replace Fiat with Mercedes
this is a little bit difficult. here Mercedes have more characters than Fiat. U cannot insert character in a file in any place other that EOF.
But replacing Fiat with a word of same character is possible. Move the file pointer to the begining of the word using CFile::Seek() function. then use CFile::Write() to replace it.
nave
|
|
|
|
|
Read each of the lines from the "old" file into the "new" file up to the line that needs to be changed. Write the line into the "new" file. Read the remaining lines from the "old" file into the "new" file. Close both files. Delete the "old" file. Rename the "new" file. Make sense?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How are you trying to open a FILE?
Using FILE * - fread(),fgetc(),fscanf().
CFile::Read().
CStdioFile::ReadString()- these classes have methods to read from the file.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
In additional you can use
<br />
CFile m_file(m_Filename,CFile::modeRead);<br />
CArchive m(&m_file,CArchive::load);<br />
m.ReadString(str);<br />
....<br />
|
|
|
|
|
wish me a good luck and I will need help.
salem ,c wiem.
|
|
|
|
|
WTF.. are you mad?
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Sarath. wrote: WTF.. are you mad?
control man control... reframe your answer.. it doesn't suit your character!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
yes... Im taking your word... leaving for this time...
Actually WTF means following
WTF (what the f***) - what the heck, what the hell, what in God's name (on the Internet)
from it's meaning, it wont make that much sensations
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
Last modified: Wednesday, August 02, 2006 5:50:39 AM --
|
|
|
|
|
Welcome to the CodeProject...
BTW, you have to know that here, we speak english...
also, if you create a new thread in a programming forum, it's mainly for asking a programming question. otherwise, choose the general forums...
|
|
|
|
|
thanks for all
salem ,c wiem.
|
|
|
|
|
|
just to say "hi" for her 1st post on CP apparently
|
|
|
|
|
|
wiemounir wrote: wish me a good luck and I will need help.
post your question Buddy!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i am working in Visual c++ / MFC 6.0.
all the thing's are done and creating the setup file.
but installshield for this version does not support calling a exe
from setup script file
LaunchApp is the function name.
so how i can call the exe from his script?
Thanks in advance
|
|
|
|
|
"Hi" is not an appropriate subject for any technical problem
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
|
can't you use latest versions?
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
You can use also from iexpress.exe in windows
|
|
|
|
|
Hello comunity,
i read files from internet, and i try to download it in compressed form, but how do decompress this
files after i have them???
this is where i try to get the file content in compressed form:
pHtmlFile->QueryInfo(HTTP_QUERY_CONTENT_ENCODING, csGZIP, NULL);
now, when csGZIP== "gzip" or csGZIP == "GZIP" i got the file in compressed form!
How to decompress them now, is there any free function to use?
regards
break;
|
|
|
|
|
break; wrote: How to decompress them now, is there any free function to use?
Zlib[^] will do the trick. IIRC, we had some problems with the header but once we managed to hack around it, it worked fine.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.3 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|