|
Read all the content of that file into a buffer (for example: a std::string or CString ), locate that line (the start pos and the end pos), remove that segment, and write all the modified buffer back to the file.
Maxwell Chen
|
|
|
|
|
To delete a line in a file, you should:
- Read the file in a buffer.
- Discard unwanted characters from the buffer
- Write the buffer content to the file
Using CStdioFile::ReadString [^] helps.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You cannot delete a line from a file.
You have to write the rest of the lines to a new file.
Then delete the original file and rename the new file to the original filename.
|
|
|
|
|
See a similar question here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Using C++ and WORD APIs, I am saving a html file as .doc.
In html file I have tags, those are link to external files. These images should also get embedded in my DOC file.
However, I could not save the images in the document itself. Is there any way that I can tell Word programatically to save the images in the document itself ?
Any help would be highly appreciated.
Regards,
Paresh.
|
|
|
|
|
Hello Friends
I am creating win32 based application and in this I am using Lots of Dialogs and Tab Change with Buttons.But when I click from one button to another button It is taking too much time around 8 to 9 seconds.
Is any way to make My UI faster ,so that It opens faster.
Thanks In Advance.
Yogesh
|
|
|
|
|
yogeshs wrote: I click from one button to another button It is taking too much time around 8 to 9 seconds.
There must be something wrong with your code...
Maxwell Chen
|
|
|
|
|
I checked all the things.But I didnt get any unrelated to my code.
Dont we have same other way to increase the speed?
Thanks
|
|
|
|
|
The first priority thing is to find out which part of your code is making it so slow (8 ~ 9 sec response time).
Is there any thread in your code?
Is there any loop (for loop, while loop) in your code?
Maxwell Chen
|
|
|
|
|
yeah for loop is there in my code but tht doesnt make any difference.
|
|
|
|
|
Nah, you're missing the point: if the UI is sluggish the way you depicted, there must be something wrong in your code (or you are using a 286 machine).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Unless the same delay happens when you do things in other software on your machine, then the problem is in your code.
The trick is to narrow down what is happening during that delay.
If it's really long, maybe you could run your code from a debugger, and break into it during that delay.
Or use Spy++ to see all the messages happening during that time - maybe you do something "clever" during this time (ie, selection changing in one area, causing a database query till a different box).
Or maybe you work out something every iteration of you loop that you should calculate once outside the loop?
I'm going to stop guessing now, as it's not possible for me to be accurate - I'm just trying to point out that you need to a) admit you have a problem (which you did by posting here on CP), and b) try to hunt it down.
At the very least, use CWaitCursor so the user doesn't think the problem is theirs!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
yogeshs wrote: I click from one button to another button It is taking too much time around 8 to 9 seconds.
Is any way to make My UI faster ,so that It opens faster.
So what are you doing when "another button" is clicked?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hello Sirs,
i have problem with create dll from command line arguments program . i tested the command line arguments its working fine when i create the output of exe. Generally command line arguments taking the value of 0th element is output of exe .
for ex:
argv1[0] = "C:\\Test.exe";
when i convert this Test.exe into dll . i have problem in 0th element .how to create command line arguments into dll ..please replay me
thanks!
Raju !!!
|
|
|
|
|
Only an executable takes command line arguments.
A DLL is loaded by an EXE and so there is no command line per say.
|
|
|
|
|
Thanks for your replay superman ..this is my exe output and listed arguments in compiler ..
argv1 = (char**)malloc(8*sizeof(char));
argv1[0] = (char*)malloc(sizeof(char)*100);
argv1[0] = "C:\\Test.exe";
argv1[1] = (char*)malloc(sizeof(char)*20);
argv1[1] = "-MM";
argv1[3] = (char*)malloc(sizeof(char)*20);
argv1[3] = "14";
argv1[4] = (char*)malloc(sizeof(char)*20);
argv1[4] = "d:\\log.txt";
argv1[5] = (char*)malloc(sizeof(char)*20);
argv1[5] = "geo";
argv1[6] = (char*)malloc(sizeof(char)*20);
argv1[6] = "80";
argv1[7] = (char*)malloc(sizeof(char)*20);
argv1[7] = "d:out.txt";
when i command the 0the argument its throwing exception ..what i can do ?
Thanks !!
Raju !!!
|
|
|
|
|
You're doing it all wrong.
Command line arguments are used to pass in arguments.
And not set them from you're program.
For example, if you run the Exe like - MyExe hello world
You can read them in your program using the parameter of main.
argv[0] will be "MyExe"
argv[1] will be "hello"
argv[2] will be "world"
|
|
|
|
|
yes you are wright ..its my fault superman ..i am not asking clearly ..
suppose i am not passing the arguments from command line ..i am just getting the arguments from the user means ....
<code>
int main(char** argv)
{
argv =(char**) malloc (3* sizeof (char));
argv[1] = (char*) malloc(sizeof(char)*10);
argv[1] = "Hello";
argv[2] = (char*) malloc(sizeof(char)*10);
argv[2] = "World";
return 0;
}
</code>
how to print the text Helloworld but plz dont use separate list like
cout << argv[0] << argv[1] ;
please replay me !!
Thanks
Raju !!!
|
|
|
|
|
If you are accepting or creating it inside your program, create new variables.
char** newvar =(char**) malloc (3* sizeof (char));
newvar[0] = (char*) malloc(sizeof(char)*10);
strcpy_s(newvar[0], 10, "Hello");
newvar[1] = (char*) malloc(sizeof(char)*10);
strcpy_s(newvar[1], 10, "World");
newvar[2] = (char*) malloc(sizeof(char)*10);
strcpy_s(newvar[2], 10, "Goodbye");
You really should do it this way though (The C++ way) -
std::vector<std::string> myvar;
std::string str;
str = "Hello";
myvar.push_back(str);
str = "World";
myvar.push_back(str);
str = "Goodbye";
myvar.push_back(str);
|
|
|
|
|
Thanks Mr.SuperMan
Raju !!!
|
|
|
|
|
Hi all,
I want to develop a small demo.exe which runs in the client system with out .Net Framework and any other dependencies
is it possible to get this through Visual C++ projects.
Please guide me some one.
thanks in advance
|
|
|
|
|
That depends on the type of project you're creating and the library functions that you're calling.
For example, if you're creating a simple UI application using MFC,
set the project properties to statically kink against the MFC DLLs.
Project Properties -> Configuration Properties -> General -> Use of MFC -> Use MFC in a Static Library
|
|
|
|
|
Thank you Friend,
Can you help me how to invoke the DLL/EXE that is developed in C# from Win32 C++ appliction
Thanks again
|
|
|
|
|
Here are a few links -
http://www.codeproject.com/KB/COM/nettocom.aspx
http://www.blong.com/Conferences/BorConUK2002/Interop2/COMNetInterop.htm#CCW
|
|
|
|
|
Hi Thanks Again
Is it possible to access the DLL/EXE without making a COM object
For Example:
Just Execute an EXE from the C++ project( like starting a separate Process)
thanks.
|
|
|
|