|
You could use the FindFirstFile() and FindNextFile() functions, then check for the FILE_ATTRIBUTE_DIRECTORY flag in your WIN32_FIND_DATA variable's dwFileAttributes member.
The MSDN page is here[^]
|
|
|
|
|
Hello,
Can any body tell what is data directory in PE file format ? and what is the main purpose of these data directories to maintain in PE format.?
Regards
Muhammad Usman Khalil
|
|
|
|
|
glitteringsound wrote: Can any body tell what is data directory in PE file format ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
See here[^].
MVP 2010 - are they mad?
|
|
|
|
|
#include <iostream>
using namespace std;
class Element{
public:
int value;
Element *next;
Element() : value(0), next(NULL) {}
Element(int v) : value(v), next(NULL) {}
Element(int v,Element *n) : value(v), next(n) {}
};
class Stack{
private:
int length;
Element head;
public:
Stack() : head(), length(0) {}
void clear();
void traversal() const;
void push(int value);
int pop();
};
void Stack::clear(){
head = Element();
}
void Stack::traversal() const{
if (length == 0)
cout << "The stack is empty" << endl;
else{
Element e = head;
while(true){
cout << e.value << ' ';
if (e.next != NULL)
e = *e.next;
else
break;
}
}
}
void Stack::push(int value){
if (length == 0)
head = Element(value);
else
head = Element(value,&head);
length++;
}
int Stack::pop(){
return 0;
}
int main(int argc, string args[]){
Stack s;
cout << endl;
for (int i = 0; i < 10; i++)
s.push(i);
s.traversal();
cout << endl;
return 0;
}
well, i m trying to implement stack structure with C++. i got a problem with this code. the traversal function runs forever, and it prints out all '9'. can any1 help with this problem ?
|
|
|
|
|
hung2h wrote: head = Element(value,&head);
The problem when you do this is that the object head after the assignment has the same address as before the assignment (head has a specific address and if you assign a new element to this variable, the address will still be the same). So, it means that the head is pointing to itself for the next element, thus you end up with an infinite loop.
You should really allocate all the elements dynamically (using the new operator). Of course, you should also delete them when you pop them from the stack.
|
|
|
|
|
many thanks to Cédric Moonen, i see it now .
|
|
|
|
|
hung2h wrote: well, i m trying to implement stack structure with C++.
YOu may also use the std::stack , see [^].
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]
|
|
|
|
|
Isn't that cheating for homework?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Nah, it is 'smart usage of available technology'
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]
|
|
|
|
|
|
The way I read this, you want to #include "sc.h" in frst.h and #include "th.h" in sc.h, but not #include "frst.h" in th.h? WQell, surely you just need to put the appropriate #include lines in frst.h and sc.h as below?
Put this line at the start of frst.h
#include "sc.h"
Put this line at the start of sc.h
#include "th.h"
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
More information might be useful, but I'd suggest reading about Forward Declarations[^] as a good place to start.
Steve
|
|
|
|
|
Right, I'll do it with forward declaration. Thanks for answers.
|
|
|
|
|
Hi all, I am new to the forum. I am currently using C program to communicate with PIC18F2620 and using TR800 to transmit text message to hand phone. I am trying to power on, reset and set the baud rate without using Hyper terminal. I am currently having some difficulty in doing that. Any help would be gratefully appreciated. Thanks in advance. Below is the code snippet.
void setup_gsm(void)
{
PWON = 1;
Delay10KTCYx(40);
RESET = 0;
putrsUSART ((const far rom char *)"AT\r");
Delay10KTCYx (50);
RESET = 0;
putrsUSART ((const far rom char *)"AT+IPR=115200\r");
Delay10KTCYx (50);
RESET = 0;
putrsUSART ((const far rom char *)"ATE=0\r");
Delay10KTCYx (50);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CLIP=1\r");
Delay10KTCYx (10);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CMEE=1\r");
Delay10KTCYx(10);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CMGF=1\r");
Delay10KTCYx(10);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CMGS=+phonenumber\r\n");
Delay10KTCYx (10);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CNMI=0,0,0,0,0\r");
Delay10KTCYx (10);
RESET = 0;
putrsUSART ((const far rom char *)"AT+CPBS="SM\"\r");
Delay10KTCYx (50);
}
modified on Wednesday, January 20, 2010 4:03 AM
|
|
|
|
|
CodeyBlank wrote: I am currently having some difficulty
Sorry, but we cannot guess what that difficulty may be. Please explain what the problem is. Does the code fail, and if so what happens - error code, abort, crash etc?
MVP 2010 - are they mad?
|
|
|
|
|
rats - you got there before me ...
'g'
|
|
|
|
|
Still amazes me how many people think we can (read minds).
MVP 2010 - are they mad?
|
|
|
|
|
Richard MacCutchan wrote: Still amazes me how many people think we can (read minds).
Since I know 'a priori' that, it doesn't amaze me: yes we can (not in Massachusetts, however).
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]
|
|
|
|
|
MVP 2010 - are they mad?
|
|
|
|
|
ok, are we supposed to guess whats happening (or not happening) ?
a) ie, where does it fail ?
b) have you single-stepped through it in debug mode ?
c) is there some sort of run-time error or any other diagnostics in your system ?
most guys would love to be able to help, but we dont read minds (my own is bad enough !!)
'g'
|
|
|
|
|
I am able to send text message when using Hyper Terminal but currently I am making it run without Hyper Terminal. There is no compiling error, but it can't send out any text message. Hoping to know is there any logic error. Please guide me along. Thank you
|
|
|
|
|
the problem is the command set would be unknown to most of us here.
a) how do you verify that the commands you're sending programmatically to the device are being received and acted on - there doesnt seem to be any status returns/checks from [putrsUSART] - you've just said do a,b,c,d etc, and there doesnt seem to be any return saying the commands are accepted or not - if you were calling a function of your own, for example, you'd have some sort of return indicator to say the function worked or not wouldnt you ?
b) what commands do you issue in hyperterm ? list them
c) if you compared those commands from (b) to what you think your code is doing, is it doing fundamentally the same ?
thats where I'd start
'g'
|
|
|
|
|
Hi,
Anyone knows how to split the tif file using CXImge library?
Thanks,
|
|
|
|
|
i am also used cxImage library ..but i coudnt understood what u need ?can u explain .... little more
Failure is Success If we learn from it!!
|
|
|
|