|
Why does this code work?:
char test[12], test1[12];
....more code...
fscanf(fp,"%d %s %s %s %s",&hour,station,country,test,test1);
And this doesn`t:
CString test, test1;
....more code...
fscanf(fp,"%d %s %s %s %s",&hour,station,country,test,test1);
The CString values are correct just after the 'fscanf', but they disappear after some other function calls.
|
|
|
|
|
You are directly modifying the contents of the CString without locking the buffer first.
CString test, test1;
LPTSTR pszBuff, pszBuff1;
pszBuff = test.GetBuffer(12);
pszBuff1 = test1.GetBuffer(12); Now you can use pszBuff/pszBuff1 in fscanf(). Call ReleaseBuffer() on both CStrings once you're done directly modifying the contents.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Thank you, so much. And then if I modify the values in many places, this way: if (...) test="some word", and so on... What must I do? Have I to make a GetBuffer before modifying it and ReleaseBuffer after each one?
|
|
|
|
|
José Luis Sogorb wrote:
Have I to make a GetBuffer before modifying it and ReleaseBuffer after each one?
Yep. See the docs on CString::GetBuffer() for some examples.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hi all,
Please introduce to me all functions or classes in C++ or VC++ about sending or reciving bits to special address in LPT port !
Please help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I am using an owner draw ListView and I have a need to display the vertical and horizontal scrollbars at all times. I've tried passing the WS_HSCROLL and WS_VSCROLL style bits to CWnd::CreateEx, but to no avail. I have been able to get the desired result by setting the control's style in response to a WM_SIZE message, however this is very inefficent.
Does anybody know a more direct way of always displaying the scrolls in a ListView?
|
|
|
|
|
maybe you should set the range
one is the other who absorbs the thoughts of others
|
|
|
|
|
is it possible to download an add on to VC++ 6 that allows building of Linux/KDE programs? And are there any tutorials on the subject.
I am trying to create Linux counterparts for my windows MFC software.
Please help.
Jonny
.NET or not .NET? Bill has the answer......
|
|
|
|
|
|
Hi all
How to update my desktop ?
In API Windows
I use
HWND hwnd;
hwnd = GetDesktopWindow();
UpdateWindow(hwnd);
but nothing append
Can u help me please...
Thank u all
Leedoriden ( FR )
|
|
|
|
|
UpdateWindow() will repaint the parts of a window that are marked invalid (i.e. in need of repainting). You should first call Invalidate() to invalidate the desktop.
There's no need to call UpdateWindow(), since Windows will eventually send a WM_PAINT message to the desktop. However, if you want to force an immediate repaint, then call UpdateWindow() right after you call Invalidate().
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello!
I want to establish data sessions between 1 server and n-clients. The data communication would be progressing between 1 server and n-clients simultaneously.
i.e.one server and many clients.i.e. N client machines would be connecting and communicating with 1 server machine. Once the connection is established, server would be accepting the data sent by the clients and then the same data would be again sent back to the same client who sent it to the server, through modem. The application should have the capability to do data transmission and receive simulnateously with n-clients.
The application is supposed to run on Win 98,WinNT, WIN 2000 and Win XP. I am using C programming and TAPI 2.0. I do not want to use COM/DCOM. Can you please tell me if it is possible to build an application of n-clients and 1 server using language C, TAPI 2.0 and without COM/DCOM.
I already have built an application for data communication between single client and single server.
Data transmission is done through the COM port to which the modem is connected.
While programming for 1-server 1 client I have made use of async comm by using CreateEvent(), ReadFile(), WriteFile() (for communciation between COM ports), WaitforSingleObject() and GetOverlappedResult().
The configuration I am using is :
There is a modem connected to the server machine and there are n (say 4) client machines. Each client has a modem connected to it. The data communication is via the modem through the COM port to send and recieve data (data communication--> client to server back to client).
If suppose, the server is waiting for connection and a client connects to the server, the connection is established and the data communication is started. Now another client attempts to connect to the server, will that client be able to connect to server ?? (as the first client is still holding the line and busy in data communication).
Do I have to have some other specialised hardware so that other clients may also connect to server simultaneously. (same as in EPBX systems).
or do I need to have some software which will help me connect n-clients to 1 server.
Could you please guide me amd give some idea about how to go about solving this problem.
Your advise would be of great help to me.
Thanking you.
With Regards,
Sandeep Shetty
|
|
|
|
|
Hello All,
Anyone with a nice algorithm to randomly generate points in a polygon? Random points based on the bounding boxes are not working nicely.
Any help or tip?
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
You mean you want to generate random points which are within the polygon ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Yes. I have the coordinates of the polygon and I need to be able to randomly select a given number of points from within the polygon. The aim is to draw dots in the polygon randomly, something to show low and high density polygons.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Two ways you could do this:
1. Generate a mask bitmap. Make it black and draw a filled polygon in white. Then for each point you generate, check if that pixel in the mask is white
2. To find out if a point is inside the polygon, use the ratio of x2-x1/y2-y1 to find out the slope of each line. Then use that ratio to figure out if that point is inside that line, or not.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hello Christian,
Thanks for the suggestions. Currently, I am doing this
1. Get the bounding box of the polygon and use it to generate the random points.
2. Create a region CRgn out of the polygon and test if the point lies in the region PtInRegion, if not generate another till I get the required number of points.
The application, however, requires a lot of speed and it deals with many polygons. I will try your suggestions too to see which is faster and less memory consuming.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Look at this link. Point inside a polygon is BIG deal to 3d/2d game programmers.
Point Inside Polygon
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks, it is yet another step closer to the goal.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
I suspect the mask will be fastest. If you make the mask a DIBSection it will be fastest of all, you'll have access to the underlying bits without having to call GetPixel in a DC.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
hello All,
I want to show the SaveDialog box in a button click .How is it possible??
SSN
|
|
|
|
|
Check out GetSaveFileName()
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
i need to develop a code which takes in a image .tiff file and reads the certain contains of the imagage and stores them in the .csv format file....can any one help me in how to achieve this.Actually this image is a bank cheque that is scanned and stored as .tiff file and need to read the amount, payable to and cheque number from the cheque image can anu help me out regarding this i will be much thankful to u all
waiting for reply
thanks in advance
BSR
|
|
|
|
|
How to get the path of the shell (Explorer)?
For example:
I open my C:\ using Explorer, i want get the from the Explorer Windows Handle...
|
|
|
|
|
I use a WndProc hook in my system...
use this WndProc hook, i have painted a button in the caption of every program. when press this button, i want it pop up a menu( the owenr draw menu), i failed. It is just effective in Explorer program, not effective in Visual Studio program, the menu item is disable...
why?
|
|
|
|