|
Why not just use PathFindExtension() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
SWDevil wrote: Maybe there is a way to check if the extension contains only numbers or something like that. Do you know?
Yes, it's called isdigit() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
For each file found, including file.x and file.y, simply check the extension to see if it is all digits or not.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
what you can do is determine the extension of the file using GetFileName and GetFileTitle. Then for each charcter in extension check if its a digit using isDigit function. If all the characters in extension are digit then keep file else move to next file.
-Saurabh
|
|
|
|
|
|
hi
I just want to know how could I send a save command to another program like notebad from my program.instade of clicking save from file menu
|
|
|
|
|
|
Hi shortwave,
You can use findwindow for get hwnd from application and use
sendmessage(hwndapplication,wm_command,idmenu(item),handlemenu);
|
|
|
|
|
I am using a read-only edit control in MFC.
New text is added to the end of the edit text ).
How can I tell it to scroll as far down as possible automatically so that
the latest text is always visible?
can anyone help me
naz
|
|
|
|
|
You can tell the control to scroll to the last line with code something like this:
m_EditControl.LineScroll(m_EditControl.GetLineCount());
Steve
|
|
|
|
|
Hi all,
Where can I find code snip of displaying a preview of my web cam using direct show?
I know how to do it using VFW(Video For Windows)...
Thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hello All !
In win32,I want to get name and icon of a application and
display it in ListBox.(this likes when choose tab Application of TaskManager program when press Ctrl+Alt+Del).
who know about this problem,please help me.
Thanks.
|
|
|
|
|
|
|
I'm developing an app which has to read binary files. The data in these files can be stored as various sizes, 1-byte 2-byte 4-byte and 8-byte. So when reading the data I need to read it as char short int and long. This is not really the problem, but reading the correct byte order is. At the begining of the file there is a flag to indicate whether the following data will be using Little-Endian or Big-Endian method.
I'm not sure how to deal with this. Could somebody please point me towards a tutorial/article which better explains all this and demonstrates how to deal with the various encodings.
Thankyou
|
|
|
|
|
|
am using VC++6 with STLPort 4.6.2
I am getting the following error in the line: (igzstream( const char*)
c:\axechopmain\axechop\gzstream.h(99) : error C2039: 'basic_ios<char,struct std::char_traits<char=""> >' : is not a member of '_STL'
[code]
class igzstream : public gzstreambase, public std::istream {
public:
igzstream() : std::istream( &buf) {}
igzstream( const char* name, int open_mode = std::ios::in)
: gzstreambase( name, open_mode), std::istream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const char* name, int open_mode = std::ios::in) {
gzstreambase:pen( name, open_mode);
}
};
[/code]
|
|
|
|
|
Have you included the iostream header file?
<edit>Oops, mean iostream, not ios</edit>
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Yes <iostream> is already included
|
|
|
|
|
I wanted to save class info,
but I got an error when class contained vector variable.
I got class info from file,
but when the program runned end, I got an error.
Error:
Debug Assertion Failed!
File: dbgheap.c
Expression: _CrtIsValidHeapPointer(pUserData)
<code>
//code list
#include <iostream>
#include <vector>
class cls
{
public:
vector<int> v;
};
void main()
{
cls s,rs;
//if not exist this code,the error does not exist.
s.v.push_back(3);
ofstream fo;
fo.open("test.txt",ios_base::binary);
fo.write((char*)&s,sizeof(s));
fo.close();
ifstream fi;
fi.open("test.txt",ios_base::binary);
fi.read((char*)&rs,sizeof(s));
fi.close();
}
</code>
-- modified at 0:39 Sunday 16th April, 2006
|
|
|
|
|
Tick the "Ignore HTML tags" button: Your code can't be read as is.
Steve
|
|
|
|
|
A vector stores a pointer to the data, not the data itself. When you write the vector to a file like that, you're writing the pointer, not the data, so when you read it back, you're reading back a pointer, not the data. You can't write vectors like that. You'll have to serialize the data in the vector.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hey, I am trying to send a variable from vb to vc6 dll, which will specify which adapter to open. The count for this machine, for instance, is 3. When the user selects a device from the list in VB, they click start and the VB app sends the corresponding number --lets say 2. Then the DLL receives the long variable and converts to u_int and shaves off one, so the value becomes 1. This value is then ran through a for loop, stopping on the device we want. This stores the name of the device in a variable which is used to open the device. All of this is currently done in a thread.
When cycling through the devices in the for loop, it always skips the first device. So, if the user wants to use device 1 of 3, the dll wont use 0, instead it fails, because 0 doesn't exist to it.
If I do the for loop in a function outside the thread, it sees all three, but I can't pass the thread the devs name, because it needs to be initilised in thread. At least that is how it seems, considering it caused a crash at run-time. I simply tried to define the variable the device opening portion needs in the separate function, I didn't actually pass it from the separate function to the thread function. I am not sure how or even if I can pass an argument to the thread function.
My question is, why wont the dll see three devs in the thread, though it sees them in the separate function? And, what do I need to do to fix it? If you need more info, let me know. Thanks in advance, have a nice day.
|
|
|
|
|
Hi borono,
It's kinda hard to pinpoint your problem without seeing any code. Could you possibly show us how you send the data, convert it and use it.
|
|
|
|
|
Geez, almost forgot I even made this post. Well, it isn't with the sendage of the data, it is with the thread. I know this because inside the thread the dev enum only sees two out of three, outside the thread the dev enum sees all three. So, it must be due to the thread.
Out side of thread: (shows all three)
for(d=alldevs; d; d=d->next)
{
if (d->description) {
MessageBox(NULL,d->description,0,0);
}
Now when the user selects a dev from the VB app and clicks start, the VB app sends the data and it is shaved by one and stored as u_int. Then in that same stdcall function, the thread is initialized. The thread grabs the variable and uses it here:
for (d=alldevs, i=0; i< ved ;d=d->next, i++);
Note: ved is my u_int variable that was used to store the data from VB.
Inside the thread...
for(d=alldevs; d; d=d->next)
{
if (d->description) {
MessageBox(NULL,d->description,0,0);
}
...that only sees two, but outside the thread it sees all three. I made checks on that variable (ved) and it is the value it should be. It is that the thread is messed up somehow, only seeing two of three devs.
Hope that helps clarify it a bit. Let me know if you need more info. Thanks in advance.
|
|
|
|