|
As already suggested, c_str method returns a const char * and you cannot pass it to the strtok function.
As workarounds you may:
- Iteratively use the
string find method. - copy the
string content to a C character array (for instance using strdup ) and then use strtok on the latter.
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]
|
|
|
|
|
|
If you really, really, really have to use strtok and:
- don't mind mangling the string
- are using a C++0x implementation of standard string
you can use &*str.begin() as the argument to strtok. C++0x has tightened up the requirements on string a fair bit so you can get away with it.
However a better solution would be to write something that copies the lump of data you're after into it's own string or use std::regex if your compiler supports it.
Cheers,
Ash
|
|
|
|
|
someone please help me i need algo for this problem!!!
You are given an integer n. Return the smallest integer greater than or equal to n that
contains exactly k distinct digits in decimal notation
Definition
Method signature: long GetSmallestInt(long n, int k)
Constraints
n will be between 1 and 10^18, inclusive.
k will be between 1 and 10, inclusive
Examples
1) 47
1
Returns: 55
Here, k is 1, so we're looking for a number whose digits are all equal. The smallest such
number that is greater than or equal to 47 is 55.
2) 7
3
Returns: 102
We need three distinct digits here.
3) 69
2
Returns: 69
69 already consists of two different digits.
4) 12364
3
Returns: 12411
mohita dubey
|
|
|
|
|
We don't do homework here.
|
|
|
|
|
plesae someone help me i need algo for this code!!
There is an integer K. You are allowed to add to K any of its divisors not equal to 1and K. The
same operation can be applied to the resulting number and so on. Notice that starting from the
number 4, we can reach any composite number by applying several such operations. For
example, the number 24 can be reached starting from 4 using 5 operations:
4 6 8 12 18 24
You will solve a more general problem. Given integers n and m, return the minimal number ofthe described operations necessary to transform n into m. Return -1 if m can't be obtained from n.
Definition---
Method signature: int GetLeastCount (int n, int m)
Constraints
N will be between 4 and 100000, inclusive.
M will be between N and 100000, inclusive.
Examples1)
4576
Returns:
14
The shortest order of operations is:4 6 8 12 18 27 36 54 81 108 162 243 324 432 576
2) 874883462
Returns: 10
The shortest order of operations is:
8748 13122 19683 26244 39366 59049 78732 83106 83448 83460 83462
3) 499991
Returns:
-1
The number 99991 can't be obtained because it’s prime!
mohita dubey
|
|
|
|
|
who can tell me, how to hook "AddVectoredExceptionHandler"?
I want to Hook the last of it argument. Modify VectoredHandler (pExceptionInfo->ContextRecord->Eip) of Eip.
|
|
|
|
|
|
thanks. i will only simple apihook. For example MessageBoxA / W, but this function is to know how to Hook
|
|
|
|
|
How i can save DC in Hbitmap...so i can use in Cimage to save shapes(Rectangles,Circles) on image...
|
|
|
|
|
You cannot, a DC is effectively an output device that is created as and when you need to draw on it. Just save enough information about your shapes to redraw them on any DC.
It's time for a new signature.
|
|
|
|
|
i'm not trying to save dc......i'm trying to attach HBITMAP in CIMAGE...i also want to know tht how i can save shapes in Hbitmap??? so i can save jpg through CIMAGE...
|
|
|
|
|
humais wrote: i'm not trying to save dc
Well the subject of your post says "How i can save DC in Hbitmap".
humais wrote: .i'm trying to attach HBITMAP in CIMAGE
I'm not sure what you mean by this, can you make your question clearer?
humais wrote: .i also want to know tht how i can save shapes in Hbitmap??? so i can save jpg through CIMAGE
Again your question is not clear. As I said earlier, you can save all the information about your shapes so that they may be recreated in some future application.
It's time for a new signature.
|
|
|
|
|
See, for instance, "Capturing an Image".
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]
|
|
|
|
|
i draw some shapes on Cimage & i want to save (shape + CImage)...so how can i do this??
|
|
|
|
|
Save the CImage then.
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]
|
|
|
|
|
plzzz tell me the coding plzzzz
|
|
|
|
|
Could you please post your code? Isn't so clear what you have really done and what you're trying to accomplish.
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]
|
|
|
|
|
Try reading the documentation[^]. Hint: look at the Save method.
It's time for a new signature.
|
|
|
|
|
Here is the code...
//hbm & image are decleared in ChildView class but not initialized in any function...if i have to initialized them ,then how i can initialized them??
HBitmap hbm;CImage image;
//the following code is in OnPaint(); function
CDC *mdc = GetDC ();
HGDIOBJ tmp = mdc->SelectObject(hbm);
mdc->TextOutA (50, 50, Text("Testing"));
image.Attach (hbm);
also tell me tht where i have to put image.Atach();function..i mean in OnPaint(); or in Save function??
//I'm drawing different shapes in OnPaint(); function using
CPaintDC dc(this);
& i want to attach it with CImage so i can save them...
It is a SDI MFC non View/Doc arch. application...Plz tell me in Detail
|
|
|
|
|
I'm not sure of all the steps you need to follow to achieve what you are trying to do, but I would suggest you follow my previous advice and study the CImage class and its members to see what functions are available to create your bitmap and save it to a file. You could also search the articles here on CodeProject and Google for sample code.
[edit]I just saw this article[^] which contains some useful tips.[/edit]
It's time for a new signature.
|
|
|
|
|
i want to know the mistakes in my code... CPallini plzz tell me how i can do that??
|
|
|
|
|
humais wrote: i want to know the mistakes in my code
What code? I have no idea what you are trying to do apart from saving something to do with GDI, for which incidentally, you have been given the answer in a previous thread.
humais wrote: CPallini
Who he?
humais wrote: plzz tell me how i can do that??
The word is please! And you can do whatever it is you need by studying samples and the documentation that I pointed you to earlier (both cases).
It's time for a new signature.
|
|
|
|
|
Hi!
Can we a read a particular line(any line, not from the start or not continuously from a line to the end of the file) at a file using fscanf? I want to discard lines other than that particular line.
|
|
|
|
|
use some logic by reading out some number of lines in order to reach the line you want to get. Keep the number of bytes you read out, fseek() to that position, and use fscanf() there.
modified on Wednesday, July 21, 2010 10:41 AM
|
|
|
|