|
|
If you do not use MFC, you can use STL. You can read the file using a stream object like ifstream , store strings in string object, and use find function to find a sequence consisting of two spaces. Then use find_first_not_of to find the end of sequence, and call erase to remove unneeded sequences.
If you do not use STL, you can use library functions: fgets to get strings, strstr or strchr to find spaces, and so on.
If you need to do this manually, you can open the file in Notepad and use Replace command
antonaras wrote: i'm going to loose all spaces i need to leave only one.
The first parameter of Replace contains two spaces, and the second one -- a single space, so any sequence of more then one spaces will be replaced with only one (maybe not so fast as possible). For convenience, I modified the sample using underscores.
|
|
|
|
|
Thanks Viorel your answer is very clear and helpful
appriciate all the help
|
|
|
|
|
Viorel. wrote: while(s.Replace("__", "_") != 0);
The loop is not required.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think the loop is required. Otherwise, in case of three consecutive spaces, only first two ones will be replaced with one space, and we will obtain two spaces in the result. Therefore we have to repeat the replace operation.
It is possible to avoid loop and improve performance using other approaches.
|
|
|
|
|
Viorel. wrote: I think the loop is required.
You're right. I spoke prematurely. Sorry about that.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi!
This might be really basic question but nevertheless I need some help
My problem is that I want a button to send two separate messages depending on if it is being clicked or released (Button down and button up) with the mouse pointer.
I am using an Visual C++ dialoge application created using the wizard.
I just can't figure out how to do it with the CButton class, or if it is even possible.
Does anyone have any input on this? I would really appreciate some kick-start help here!
Thanks,
Larssen
|
|
|
|
|
Create a class derived from CButton say CMyButton.
Now in that class override the OnLButtonDown and OnLButtonUp events.
Include the file MyButton.h in the class where you are using the button.
Add a variable to the button.(call it m_btn)
Open the header file of the dialog and change CButton to CMyButton
You are done with this
You can test the code by putting message boxes in the button class you created.
To test the LButtonUP functionality click anywhere in the dialog and take the mouse on the button with LButton Pressed. Release the Mouse button on the button on the dialog.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Hello everyone,
I am going to add some source files (.c, .cpp and .h) to a project in Microsoft embedded VC++ 4.0. There are a lot of source files and they are organized in their source tree file structure. I am wondering what is the most convenient way to add them all to an embedded VC++ project. Currently, I have to add them one by one (by "Add files to project" context menu of a project), which will break original source tree structure (which adds all the source files to "Source Files" folder in FileView).
thanks in advance,
George
|
|
|
|
|
Hi,
I need to create a modeless dialog with minimise and maximize button in win32 application .( so what have to set in sytle attribute in the dialog template ....
Manjunath S
|
|
|
|
|
|
Dears Sir,
Every time when I change Pc or when Réinstall pc i have a difficult with my program source.
Before changing pc I have copied all the directory of my program, after changing I reload it on my pc, but when I compile I have news messages that i don't have before. What to do ? These are messages:
--------------------Configuration: STOCK - Win32 Debug--------------------
Compiling...
Property.cpp
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(35) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(36) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(37) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,const struct std::nothrow_t &)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl op
erator new(void))(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(41) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2556: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,void *)' : overloaded function differs only by return type from 'void *(__cdecl *__cdecl operator new(void))(unsig
ned int)'
c:\program files\microsoft visual studio\vc98\include\new(35) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\new(42) : error C2065: '_P' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\memory(16) : error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2091: function returns function
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2784: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' : could not deduce template argument for 'void *(__cdecl *)(u
nsigned int,class std::allocator<_Ty> &)' from 'void *(__cdecl *)(unsigned int)'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2785: 'void *(__cdecl *__cdecl operator new(void))(unsigned int,class std::allocator<`template-parameter257'> &)' and 'void *(__cdecl *__cdecl operator new(void))(unsigned int
)' have different return types
c:\program files\microsoft visual studio\vc98\include\memory(16) : see declaration of 'new'
c:\program files\microsoft visual studio\vc98\include\memory(17) : error C2809: 'operator new' has no formal parameters
c:\program files\microsoft visual studio\vc98\include\memory(20) : error C2954: template definitions cannot nest
C:\progms\STOCK\Property.cpp(1219) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Error executing cl.exe.
STOCK.exe - 17 error(s), 1 warning(s)
I learn my self
|
|
|
|
|
My guess is you copied some code from a MFC project to a non-MFC project, and the MFC code redefines new to DEBUG_NEW to get some MFC memory-tracking features. Remove the redefinition.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
|
please explain your problem more clearly.
we don't call a function from a file ("call funcation named start_Login() which is is source file "Call_Main.cc" from the "Form1.h"") but from a function (main() or any else...).
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Hi..
I want to call function named start_Login() which is is source file
"Call_Main.cc" from the "Form1.h" on button click event.
Simple is that i want to call a function which is in source file "call_Main.cc"
not in class. from the clicked event of a button.
Rahul Kulkarni
|
|
|
|
|
i suppose the function definition is in .cc file, but the declaration of the function should be in a header file (.h file).
then, include your header everywhere the functions declared inside are needed.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Have u added header file of Call_Main.cc in "Form1.h"
never say die
|
|
|
|
|
Can you be more specific whats Form1.h(whats type,class) also you need to inclide file form1
whitesky
|
|
|
|
|
Hi..
actually what the thing is i have a project in console application working properly.
Now i want to make it windows application. I have copied all the file of the console
application to new Window application. now main is in call_main.cc file. I want to call the main
and replace the console.writeline() by messagebox::show. Can i do this.
Else give me suggetion to make console application to windows application simply.
Thanks in Advanced
Rahul Kulkarni
|
|
|
|
|
|
how to move bitmap using mouse cursor. when the bitmap is larger than a dialog box i create a scrollbars.but i now we should move the bitmap by using mouse cursor when we click the mouse and move bitmap also should move.when we release it should stay at waht position we release.
thank u in advance.
sree
|
|
|
|
|
A possible scenario. First you need to process the WM_LBUTTONDOWN notification message, sent to your butmap’s window. Within the handler, store a true value in a boolean variable, and save the position of the cursor and the scroll position (GetScrollPos ). In addition, take the possession of the mouse using SetCapture function.
Then, in WM_MOUSEMOVE handler, if the boolean variable is true , scroll the bitmap window according to the current cursor position and stored values.
In WM_LBUTTONUP handler, set the boolean flag to false , and release the mouse possession using ::ReleaseCapture . The same actions must be done in WM_CAPTURECHANGED handler.
In addition, you can handle the WM_SETCURSOR message in order to change the mouse cursor shape while the bitmap is scrolled.
|
|
|
|
|
thank u.
do u ahve any sample code.
|
|
|
|