|
yesh i resloved the issue.
it is due to file is generated by windows
so it contain /r/n so now i created file in unix system , now it resolved my issue. but how we handle such situation
|
|
|
|
|
Add something straight after the getline call to remove a trailing \r? Like this:
if (*data_string.rbegin() == '\r')
data_string.erase(data_string.length()-1);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hint - you haven't got ls in your map!!!! You've got dir , which is the WIndows equivalent, but not ls .
When you add
ls,/code>, it works. I know, I've just run it on OS X, which is a Unix... <br />
<br />
<div class="ForumSig">Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p</div>
|
|
|
|
|
When we create an owner draw Listbox, We override DrawItem() and MeasureItem(). But this just draw item for Listbox. How to draw border for ListBox?
|
|
|
|
|
You mean you want to draw a custom border around your list control? If so, try handling the WM_NCPAINT[^] message.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I wrote a Queue class in java with the method Add
public void add ( Object x )<br />
{<br />
items[rear] = x;<br />
rear = (rear + 1) % items.length;<br />
++count;<br />
}<br />
Now I'm trying to write it in C++. My problem here is I can't use rear = (rear + 1) % items.length;
Since I can't use items.length, what would that be equivalent to in C++?
Thanks in advance,
Jonig
|
|
|
|
|
You'd keep track of the allocated length of items yourself. (Yes, it's annoying that you can't get the allocated length in C++, even though it's available to library code.)
|
|
|
|
|
Or use any standard containers like std::vector rather than plain arrays.
|
|
|
|
|
Use the STL deque[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
If you just want to use a queue, then the STL already has one[^].
If you're doing this for a learning experience, then the first thing to learn is that C/C++ arrays a) are not easily resizable and b) do not track their own length. If you want to do this with arrays, then you'll need to reallocate arrays when they get too small (remembering to copy all the elements to the newly resized array) and also keep track of the number of allocated and used array elements. Or you could use an STL container like a vector in place of the array.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi
I have a MDI application. How can I get the number of the "CMDIChildWnd" initialized?
Thanks
|
|
|
|
|
|
Hi all,
I am wondering if we can get sourcecode information when an exception occurs. I understand we need debug symbols to get actual source file and line number, but is there a way I can get a unique identifiers that describe the source file and linenumbers where the crash occured - somethng from the dissembly of the callstack? Microsoft must be doing this internally, but is this information available for external developers? Your help is very much appreciated.
Nachiket
|
|
|
|
|
Well, unfortunately if your using Visual Studio 2005 or higher then you need to parse the PDB to obtain the line number in a Release build. Unless you want to add __LINE__ macros[^] all over your code...
This may help:
Retrieving Symbol Information by Address[^]
If you are using Visual Studio 2003 or below you can use the /MAPINFO:LINES linker option. This will create a MAP file which contains symbolic names, address offsets and even line numbers at the bottom. When an exception occurs all you needed to do was walk the list of line numbers and compare the address of the exception to the ones in the list.
I dont really know why they removed the /MAPINFO:LINES option but I suspect it has something to do with VS2005 optimizations.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks David. That was really helpful information.
|
|
|
|
|
Hello. I'm writing a program using M$ Visual C++. Is there a simple API for getting the file size? Something like GetFileSize? I'm trying to read out bytes from a binary file, and I think it's prematurely reading out an EOF character. So, I need to query the filesize from the OS. Thanks.
|
|
|
|
|
pcpro178 wrote: Is there a simple API for getting the file size? Something like GetFileSize?
You mean something like GetFileSize()[^]? Yeah, there is.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Well, yes, but GetFileSize requires a variable of type HANDLE to be passed to it. I have a FILE variable instantiated, but how do I go from one to the other?
|
|
|
|
|
If you insist on the FILE pointer, you can do this:
fseek(file, 0, SEEK_END);
filesize = ftell(file);
fseek(file, 0, SEEK_SET);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
There are multiple ways including the following simplified code (will not compile):
FILE* pFile = fopen();
if (pFile)
{
int fileNum = _fileno(pFile)
HANDLE hFile = (HANDLE) _get_osfhandle(fileNum);
GetFileSize(hFile);
}
|
|
|
|
|
Thanks! This was a huge help!
|
|
|
|
|
I need to draw an image that is able to zoom in many times, the image in question is of a city. Currently I am drawing the image using a .bmp file, the problem is when I zoom in too much I get the blocky, pixelation associated with .bmp files. I would like some suggestions, ideas, tutorials, etc. on what I should do to keep the fidelity of the image a any zoom level. Should I use a paging scheme for the drawing, is it possible to draw some vector based image or I there something else I should be looking into? General info: drawing using MFC GDI functions, the current image size is around 100 mb. Thanks in advance for any guidance.
|
|
|
|
|
I suggest you try PhotoShop first to resize your image smaller for multiple times.
If PS can not do it well, you should give up.
Or you may need to use jpg format to zoom in your image - zoom in with jpg is better than bitmap format.
|
|
|
|
|
includeh10 wrote: zoom in with jpg is better than bitmap format
Really, have you tried it?
It's the same, except now you have jpg artifacts all over the place.
|
|
|
|
|
includeh10 wrote: zoom in with jpg is better than bitmap format
neither format has any influence on the ability to zoom on the final image. after decoding either, you get an array of pixels - and pixels are pixels, regardless of where they came from.
|
|
|
|