Banfa 597 Posting Pro Featured Poster

You can't initialise anything that has already been declared. You can only initialise something at the time it is created, after that it becomes assignment.

And to answer the spirit of your question no there is no way to assign to all members of an existing array without recourse to a for loop (with the exception of using memset on an array of char).

Banfa 597 Posting Pro Featured Poster

the function feof returns

A non-zero value is returned in the case that the End-of-File indicator associated with the stream is set.
Otherwise, a zero value is returned.

A non-zero value can be anything (other than zero), 1 is a common possibility, -1 might be as well.

At the end of the stream fgetc returns EOF. EOF is defined as

[any] negative integral constant expression

EOF is any negative value quite often -1.

So at the end of the file while ( (ch=fgetc(fd)) != (feof(fd)) ) is equivalent to while ( <Any negative integral value often -1> != <any integral value that is not 0 possibly -1>) ) .

There is a lot of possibilities where these equality will be true and the loop will continue.

You should either use the return value of fgetc or the return value of feof but you should not compare the return value of the 2 functions. while ( (ch=fgetc(fd)) != EOF ) or while ( !feof(fd) ) Noting the the second version does not actually read anything from the stream if it is not the end of file.

Banfa 597 Posting Pro Featured Poster

You are not taking account of escaped characters in strings, for example how would your code cope with the string "\"//" .

You are not taking account of character constants, how would you software cope with '"' This while ( (ch=fgetc(fd)) != (feof(fd)) ) is wrong and might well result in your reading past the end of the file. I suggest you read up on the return value of the 2 functions called.

Banfa 597 Posting Pro Featured Poster

Well I did a web search on "linux command line parameter autocomplete" and read the linked articles.

There is related stuff in

/etc/bash_completion.d/
/etc/bash_completion

This is really a Linux not a C++ question so I would recomend you find a good Linux forum and ask there.

Banfa 597 Posting Pro Featured Poster

That is not a part of the program itself as the program is not running until <Enter> has been pushed on a valid command line.

It is a function of the shell (Bash) what I can not tell you is if it is built into the shell or if the shell is reading a file somewhere allowing you to provide auto-completion data to the shell for your program.

Banfa 597 Posting Pro Featured Poster

Perfect numbers are few and far between the next perfect number after 8128 is 33550336 which is rather greater than 1000000 so your program can not find it.

It would appear that your program may be working.

Banfa 597 Posting Pro Featured Poster

An array of structures with what members?

If you do not know the format of the binary file about the best you can do is read it into an array of char.

Banfa 597 Posting Pro Featured Poster

Start a command prompt and run you program in it.

Dev-C++ is a bit long in the tooth you may want to try something a little more up-to-date like CodeBlocks.

Banfa 597 Posting Pro Featured Poster

The error probably appears random because you are calling gai_strerror when you should be calling strerror.

Banfa 597 Posting Pro Featured Poster

At line 100 this letters[ ((i % 100)/10)* 10 ] + letters[ i%10 ] can be replaced with letters[ i % 100 ] Think about say 345, this is working out the number of letters in 45, you method adds the number of letter in 40 (forty) and 5 (five) however if you are calculating letters in 345 you have already calculated letters in 1 - 99 so you can just use the number of letter in 45(forty five).

This may also fix you problem because now consider 317, you code calculates number of letters in 10(ten) and number of letters in 7(seven) which is 8 but you actually need number of letters in 17(seventeen) or 9.

Banfa 597 Posting Pro Featured Poster

You shouldn't be putting paths into #include statements on the whole, it makes it very hard to take the code to another computer unless it has exactly the same hard-drive and directory set-up.

You can pass the directory(ies) to search for include files into the compile normally using the -I switch or set it in your IDE in the project properties.

Banfa 597 Posting Pro Featured Poster

But that doesn't mean I didn't compile. That was because I tried something else on it before I posted the code. It doesn't work still. Nothing gets copied.

I hope I don't really need to say this but it really is best to post the correct code version when you are asking a question.

It seems there's some problem in the while loop. It seems not to copy anything. I cannot figure out why. Please help.

You mean the program produces no output? Or rather

string1: Hello
Copying string1 to string2....
Now string2:

Be precise when describing your problems, the program output and the expected program output it will help us to help you.

Your length function is wrong, as has been highlighted already.

Also you code does not allocate space for the NUL ('\0') terminator that C uses at the end of its strings and you don't put a NUL terminator into the copied string.

Banfa 597 Posting Pro Featured Poster

I would say you have 2 options (remembering that the majority of processes, even multi-threaded ones do not actually run concurrently, mostly they time-slice, that is each thread gets a chance to run in turn and while a thread is running non- of the other threads of the process are running).

Firstly you could create a properly multi-threaded program using the API of your OS to create 1 (or more) threads to perform the required tasks. You will need to ensure you protect any data you use in both threads from simultaneous access by both threads, normally done with a mutex (or Critical Section on Windows).

Secondly, if this is a small and simple program you could use a super-loop. Super-loops were more common before the days of (pseudo) multi-tasking (on DOS then) but I still see them occasionally on very low powered micro-processors that really do not need or don't have the resources for an OS.

A super-loop construction is simple, it is a loop (for/while/do while) and each task has a function that is called from the loop. It is important that those task functions do not "pause" because that would interrupt the other tasks. An advantage is that because there is only 1 thread of execution you are guaranteed that when 1 task is running the other tasks are not accessing any data.

The top-level of a super-loop would look something like this

bool task1();
bool task2();

int main()
{
  bool task1Finished; …
Ancient Dragon commented: good suggestions :) +35
Banfa 597 Posting Pro Featured Poster

Of course like this

#define ROOT "C:\\SomeRoot\\"
#define SUB_DIR ROOT "SubDir\\"

A rarely use feature of C++ (and C) is the the compiler automatically contatinates contiguous strings.

A better question is should you given this is C++ or should you just use constant objects

const std::string root = "C:\\SomeRoot\\";
const std::string subdir = root + "SubDir\\";
Banfa 597 Posting Pro Featured Poster

Your code doesn't try to send anything.

Most UARTs also produce an interrupt, normally on data received, on error and possibly on ready to send data.

It is common (and therefore I assume I good approach) to handle data receive using the UARTs interrupt and it is often a requirement to handle the error states of the UART which is also most easily done using the interrupt. Send can either be polled or interrupt driven, polled works well if you want to be sure the data has been sent before your program continues while interrupt driven works if you want to just fire and forget i.e. you don't need to know when the data has been written.

Banfa 597 Posting Pro Featured Poster

Have you compiled the latest code you have posted?

Banfa 597 Posting Pro Featured Poster

char* temp = (char*) malloc(sizeof(*string1)); Consider string1, what type is it? char * from the function prototype.
In that case what type is *string1? If string1 is char * then dereferencing it gives char.
What does sizeof(char) return? 1 (by definition in the C standard)

I do not believe you wanted to allocate an array of 1 byte, I assume you want to allocate enough memory to hold the string what string1 points to. You need to count the number of characters that string1 points to (and then add 1 for the terminator), equivalent to strlen(string1) + 1 but presumably you are not allowed to use strlen either so you may have to write your own version of this.

Your loop looks OK to me but then consider string2 = &temp; What does this do? Alters the value of string2 which is a local variable. Since the variable is local that change is lost when the function exits so the function alters nothing outside itself. You want to return the string that temp now points to, that means that you need to alter something outside the function and that normally means dereferencing a pointer passed into the function to alter what it points to (assuming you are not returning the value). You need something that looks like *string2 = ???; , I leave the ??? for you to fill in.

Finally consider how you call your function copyString(string1,string2); From above we now that string2 …

Banfa 597 Posting Pro Featured Poster

You have some many blank lines it makes your code much longer than required and so less readable.

You have redundant duplicate variables, for example M in dc4 is just a copy of nrows, however neither variable is ever changed so one of them is redundant.

However I believe your error is actually on line 244 of your posted code, work through the logic of your own program.

Banfa 597 Posting Pro Featured Poster

Other people have mentioned creating a single instance of the class and passing it to everything else.

I can honestly say that I can not see anyone where I work viewing that as a good idea. I work on one of our smaller projects and it has ~560 cpp files and ~750 h files and since classes are defined approximately 1 to a header file (say about 700 classes) I can't see passing an object by reference into all of them as being a good idea. If you are multi-threading then that also complicates the process of passing a single (or worst more than 1) pointer round everywhere.

Of those 700 classes I would guess may be 4 - 5 are singletons, each one with a very well defined purpose.

An example that appears in many of our projects is an error (or event) logger to allow logging and printing of messages about program state to the screen (if there is one) and also file (if there is a filing system) and other locations (over the network for example). You are going to want to be able to output status messages from anywhere and a class nicely encapsulates the code and data required to do this.

It is this kind of service that is not really a part of the job that the program does but that is a service required by all parts of the program that I would consider a singleton for.

What …

Banfa 597 Posting Pro Featured Poster

You do not have to wait to see if an event is set. You can test the event without waiting if you call something like WaitForSingleObject with the dwMilliseconds parameter set to 0 then the function will return immediately indicating if the event signalled or not at that time.

Banfa 597 Posting Pro Featured Poster

The if statement (line 32 - 48) needs to be inside the else block (line 27 - 31) because that code should only be run if ab != 0. The return at line 24 then becomes redundant (it is not uncommon for coding standards to ban returns in the middle of functions).

Then you need to put a big loop round the new contents of the else block, remove the second request the amount and go round the loop if !(ab>=wdraw) to get more input.

The basic design should be that there is only a single place that requests the input of the value that you then test and use if it is valid. if it is not valid you output an error and start the process again.

Banfa 597 Posting Pro Featured Poster

Global data is bad, however it is not always avoidable. There are no hard and fast rules in C++ just best practice and less good practice and you need to know when to ignore best practice.

I would say make a big effort to avoid making any global variables that are not a pod type (pointers, char, integers, floats, bools) i.e. no global data with a type of class or struct (noting that structs and class are more or less the same).

I say this because if you do then those variables get constructed before main is running and destructed after main exits and you end up with code running at times when you can not really be sure of the state of the system. And if you have more than one defined in different files you have no control over the order the construction takes place in.

Singletons do have there uses but remember the purpose of a singleton is not to replace global data but to provide a class that guarantees that the entire program uses the same instance of it while still providing the object orientated advantages of encapsulation, hierarchy and polymorphism.

However I implement them with a static pointer to the type rather than a static copy of the type. A pointer is a pod and causes no problems with code running outside main, then you first time the singleton is accessed you simple construct it (or if you prefer have a …

Banfa 597 Posting Pro Featured Poster

Or a set would work, a set of the actual values would returned not found if you looked up a non-existing value.

On NULL it really only applies to pointers. It is a special representation for the platform that indicates that the pointer is invalid. The NULL pointer for a platform does not have to have the value 0 but a compliant C++ compiler does have to convert the value 0 used in a pointer context in the code to the platforms NULL pointer value. Of course on many(most?) platforms the NULL pointer value for the platform is actually 0 so the conversion is quite simple.

This should not be confused with NUL the name of one of the control characters (the first 26 characters) in the ASCII character set that has the value 0 or '\0'.

Neither NULL or NUL apply to any form of integer(int) or floating point type.

jonsca commented: Good one. +6
Ancient Dragon commented: great answer +35
Banfa 597 Posting Pro Featured Poster

If you have altered the code then re-post it, particularly the functions sendLogin and listUsers which sound like they have received the most modification.

After calling send you try the following

if(sent_bytes != strlen(cmsg)) {
    printf("Wrong amount of data was sent.\n");
}

This is not the correct way to handle send. Send may not send all the data you provide it rather depends on the underlying link and how busy the network is and a number of other things. If send has not sent all the data you wanted it is normal operation rather than an error, you should call send again with the rest of the data.

This is all rather well explained in "Beej's Guide to Network Programming" which you can find at http://beej.us/guide/bgnet/ to either download or buy as a book.

Banfa 597 Posting Pro Featured Poster

Line 28 and 47 of the client you strcat into an allocated buffer that contains random data (malloc does not clear the contents of the memory it allocates).

Make the first call in each of those sets strcpy.

Banfa 597 Posting Pro Featured Poster

OK to start with if you enter a string longer than 3 characters you overwrite the end of the allocated buffer. Writing outside the bounds of a valid object results in undefined behaviour. Once you have undefined behaviour anything may happen.

You should use the function fgets rather than gets because it prevents buffer over-run in this manner.

You problem lies in this line if(sizeof(str)>4*sizeof(char)) . sizeof(str) is almost certainly not doing what you thing it is. it returns the size in bytes of the object str. What is str? From you code it is a char* . In most cases on a 32bit system the size of a pointer is 4 bytes (and 8 on a 64bit system) so sizeof(str) is going to return 4, in fact this is calculated in the compiler because it is a value that is fixed at compile time.

The other half of the condition is also a constant that the compiler can calculate

sizeof(char)

is 1 (as defined by the standard) and the compiler knows this and can easily do the multiplication to get 4*sizeof(char)) is 4.

So your if statement is resolve by the compiler as if(sizeof(str)>4*sizeof(char)) equivalent to if(4>4) , and since 4 is not greater than 4 equivalent to if(0) . An optimising compiler will calculate this and it will not even put your error code into the program.

I suspect you indented to use the function strlen to get the number of characters …

Banfa 597 Posting Pro Featured Poster
cout<<(char)0208;

BTW you do know that the leading 0 on 0208 effectively tells the compiler that the number is in octal (base 8) in the same way 0x indicates a hexadecimal number?

Have you tried

cout << setw(4) << setfill('0') << 208;
Banfa 597 Posting Pro Featured Poster

May I ask how you process the e example since cout<<(char)1154; is equally likely not to work?

Banfa 597 Posting Pro Featured Poster

How about you don't try and individually allocate and reserve each byte of memory. Also is there any reason why you are doing it in 2 dimensions? Why a metric of mxn bytes and not just a flat p bytes (where p = n*m)?

So if you have a flat model what you can do is build up a list of blocks (that may be free or used (you could hold the free used list individually) using a structure something like

struct memBlock
{
    struct memBlock* next;
    unsigned int size;  // Size of this block
    unsigned int used;  // Could be bool 0 = not used 1 = used
};

You write one of these structures at the front of each memory block you currently have so at initialisation you have a single one at the head of your array with next set to NULL and size set to array size - sizeof struct memBlock and used to 0

You have a function that can take a single memory block and split it into 2 1 with a specific sized block and 1 with everything that's left over.

To release a block you just send used to 0 if you want you can check nearby blocks and merge them if they are all not used.

To allocate you find an unused block that is large enough to hold the required memory, if it is very much bigger than the required memory you split off a …

Banfa 597 Posting Pro Featured Poster

Your problem is most likely in stot with the variable tInfo which you use without initialising all its members, specifically tInfo.tm_wday, tInfo.tm_yday and tInfo.tm_isdst.

The first 2 of which can be initialised to 0 they seem to be corrected by mktime although that may just be an implementation feature but they are certainly ignored in creating the output. tInfo.tm_isdst is important because it relates to day-light savings time being in effect.

Banfa 597 Posting Pro Featured Poster

You are right about the coding not being good because it alters degree, in fact operator+ and all binary operators and act on 2 operands to produce a new result are best declared const Poly Poly:: operator+(const Poly& p) const;. That way the compiler enforces the policy of not changing the object that the operator is being called on.

Basically in your operator+ you need to just set the degree of temp rather than altering the degree of the object it is being called on.

Banfa 597 Posting Pro Featured Poster

I think you mean Ld returned 1 exit status.

Do you really mean you tried to link the 2 c files and the h file or do you mean you compiled the c files and tried to link the resulting objects?

The processor of building a program is

  • Compile each individual source (.c) file producing an object file (.o or .obj)
  • Link all the object files produced in stage 1 with any require libraries

NOTE 1: you neither compile or link header (.h) files, they are included into source (.c) files and the code the contain is compiled in that manner.

NOTE 2: It is very poor practice to #include source files (.c) into other source files (.c) as you have done in your driver.c listing. However if you must/do do that then you should not separately compile the source (.c) that you included.

Normally the IDE handles the build process for you so it would help us to know what tools, compiler tool-chain and/or IDE you are using.

Banfa 597 Posting Pro Featured Poster

The #define LWIP_MEMPOOL line creates the elements of the enum when combined with memp_std.h. This #define causes every line in memp_std.h to be an element in the enum including the comma.

It doesn't matter where the #define is written, it is a text substitution and gets included where the symbol LWIP_MEMPOOL appears in the code. That is in the code included from memp_std.h.

The process in the preprocessor is something like this (assuming the format for memp_std.h is what I gave in my first post)

#define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
typedef enum {
#include "lwip/memp_std.h"
MEMP_MAX
} memp_t;
#undef LWIP_MEMPOO
  1. Read line 1: it is a #define, remember the definition and remove it from the code.
  2. Read line 2: there are no preprocessor directives on the line so leave it alone
  3. Read line 3: it is a #include directive, open the given file and copy it into the current source file. At this point the code looks like this
    typedef enum {
    
    LWIP_MEMPOOL(Pool1,100,8,"8 byte pool") 
    LWIP_MEMPOOL(Pool2,100,16,"16 byte pool") 
    LWIP_MEMPOOL(Pool3,100,32,"32 byte pool") 
    LWIP_MEMPOOL(Pool4,100,64,"64 byte pool") 
    
    MEMP_MAX
    } memp_t;
    #undef LWIP_MEMPOO
  4. Read the contents just included starting at line 4
  5. Read line 4: It contains the symbol LWIP_MEMPOOL, the preprocessor has a definition for this symbol so make the text substitution for line 4
  6. Read line 5: It contains the symbol LWIP_MEMPOOL, the preprocessor has a definition for this symbol so make the text substitution for line 5. At this point the code looks like this
    typedef enum {
    
    MEMP_Pool1,
    MEMP_Pool2, …
amala.123 commented: Thanks a lot for your patience and very well explained +1
Banfa 597 Posting Pro Featured Poster

No your example with colour is all wrong, you just define a few symbols you never create enum entries for RED, GREEn and BLUE. That is the code you have written is not equivalent and does not pre-process to

enum colours
{
RED = 10,
GREEN= 20,
BLUE=30,
PINK
};

In particular the contents of c.h is nothing like the contents of memp_std.h, memp_std.h does not #define anything.


When you define an enum normally you have a , between each element. This is a syntactical requirement. The comma at the end of #define LWIP_MEMPOOL is this comma. You last proposal of writing #define LWIP_MEMPOOL without the , will not compile because there will be no commas between the elements of the enum.

With a comma you get a valid enum definition

typedef enum {
MEMP_Pool1,
MEMP_Pool2,
MEMP_Pool3,
MEMP_Pool4,
MEMP_MAX
} memp_t

Without a comma you an enum definition without commas with is not syntactically correct

typedef enum {
MEMP_Pool1
MEMP_Pool2
MEMP_Pool3
MEMP_Pool4
MEMP_MAX
} memp_t
Banfa 597 Posting Pro Featured Poster

Line 35, you add to text which is declared as a handle at line 9 but never gets an object assigned to it.

I think, with my very limited knowledge of .NET, you need to gcnew String an object to text.

Banfa 597 Posting Pro Featured Poster

It has no formal definition so its meaning is defined by the context.

Normally it just means group of related things so a module could be a group of related classes or a group of related source files, possible with-in a single process or in separate processes.

I think in your quote it problem just means "a chunk of code".

gozlemci commented: for your interest +0
Banfa 597 Posting Pro Featured Poster

You are overwriting your arrays, when you declare a variable char str1[]="" since you have not specified an array length but you have specified an array initialiser the compiler allocates exactly the right array size to fit the initialiser into it. In your case an array size of 1 or the equivalent of char str1[1]="" .

When you scanf your strings it copies the input string into the array and adds a zero terminator but that certainly goes outside the size of your allocated arrays.

In both cases that means the second scanf overwrites the input data of the first, in the second program this is evidenced by the length of the string being wrong.

Writing outside the bounds of an array is undefined behaviour, which is bad, and should be avoided.

Something like char str1[100]="",str2[100]=""; is a simplistic way to solve your problem (but don't type more than 99 characters).

sundip is also correct about failing to return a value from len.

Banfa 597 Posting Pro Featured Poster

That is not the comma operator. That is the comma syntax element required in-between enum values when defining an enum. Like I said the combination of the #define and the contents of memp_std.h has to result in valid syntax for defining an enum.

Banfa 597 Posting Pro Featured Poster

You can't do that. The best you can do is have an array of structures containing the names and the appropriate function pointer so you can look up the name in the array and then call the associated function pointer.

Banfa 597 Posting Pro Featured Poster

I know why (I think), IIRC the linker does a single pass of the files, when you have lib/ft/libmbusmaster.a before client.o it looks in lib/ft/libmbusmaster.a and because it hasn't seen anything yet that uses it discards all of it. Then it tries to link client.o and finds lots of unresolved externals.

The other way round in looks in client.o first, finds lots of unresolved externals then looks in lib/ft/libmbusmaster.a and resolves them.

Banfa 597 Posting Pro Featured Poster

Instead of lib/ft/libmbusmaster.a on the g++ command line try -llib/ft/libmbusmaster.a or -l lib/ft/libmbusmaster.a

Banfa 597 Posting Pro Featured Poster

OK lets get this straight, I personally would write this

typedef enum {
#define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
#include "lwip/memp_std.h"
MEMP_MAX
} memp_t;

as

#define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
typedef enum {
#include "lwip/memp_std.h"
MEMP_MAX
} memp_t;
#undef LWIP_MEMPOOL

I put the #define outside the enum because I don't think it looks good inside and I #undef the symbol once I have finished using it in case I need to use it again later.

The exact use, in this case of the #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, in combination with the file memp_std.h is to provide a definition of LWIP_MEMPOOL that results in a valid line in the enum, the result being an enum value for every pool in the memory manager.

The line LWIP_MEMPOOL(Pool1,100,8,"8 byte pool") under the definition of the the symbol LWIP_MEMPOOL as #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, processed by the preprocessor results in the compiler seeing the code line MEMP_Pool1,

so the actual code listing

typedef enum {
#define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
#include "lwip/memp_std.h"
MEMP_MAX
} memp_t;

After preprocessing using the version of memp_std.h that I gave results in the compiler seeing

typedef enum {
MEMP_Pool1,
MEMP_Pool2,
MEMP_Pool3,
MEMP_Pool4,
MEMP_MAX
} memp_t;

ie it defines an enum entry for every pool.

The concept is simple, you have a group of objects whose values are never going to change an runtime and you want to automatically produce the data and symbols to handle them, but there are several different data objects and symbols being defined and you want …

Banfa 597 Posting Pro Featured Poster

What you are saying doesn't make sense, the closest method I can find to what you have described is void QListBox::insertStringList ( const QStringList & list, int index = -1 ); That takes a QStringList which is in fact a QValueList specialised for QStrings

Banfa 597 Posting Pro Featured Poster

I have seen and used this trick before. The file memp_std will contain a list of items defining the memory pools for the system something like this

LWIP_MEMPOOL(Pool1,100,8,"8 byte pool") 
LWIP_MEMPOOL(Pool2,100,16,"16 byte pool") 
LWIP_MEMPOOL(Pool3,100,32,"32 byte pool") 
LWIP_MEMPOOL(Pool4,100,64,"64 byte pool") 
...

normally without inclusion tags.

Then when you want to do something with memory pools, like define an enaum for each one you #define the symbol LWIP_MEMPOOL to produce the desired output, a valid enum tag in this case, and include the file. Personally I would then undefine LWIP_MEMPOOL.

The second example you posted then #defines LWIP_MEMPOOL to produce the initialiser for an array containing the block size for each pool.

Banfa 597 Posting Pro Featured Poster

You should not be much effort at all to convert std::list<employeeObject> to QValueList<employeeObject>.

In fact all you need to do is change the type. QT containers are compatible with the STL so you can use pretty much all the STL algorithms on a QValueList as you would on a std::list.

Banfa 597 Posting Pro Featured Poster

Sorry that's a typo on my part should have read

"you can't directly compare C style string using =="

Banfa 597 Posting Pro Featured Poster

That is right you can directly compare C style string using ==. You need to use the library function strcmp

Banfa 597 Posting Pro Featured Poster

Do you mean you have strings of 1s and 0s that you need to add as if they were binary numbers?

All actual integers are held in binary (on the whole) anyway so adding 2 binary digits is as simple as

int a = 2;  // binary 10
int b = 7;  // binary 111
int c;

c = a + b;  // result = 9, binary 1001
Banfa 597 Posting Pro Featured Poster

Which version of visual studio?
Which microsoft technology are you using to write your programs, .NET, MFC, WIN32?

Banfa 597 Posting Pro Featured Poster

You could set a timer and do the edit box update in response to the timer event.

Of course what will make it very hard for the user to edit the contents.