Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>copy all the contents of one partition
I don't know what that means. Copy all the files? such as all files/folders on C: to D: ?

Here is the code you need. It will give you the list of all he files and directories. Use the win32 api function CopyFile() to do the actual copying.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Won't making sql_backslash_to_underscore return strings break this?
Not if you are allowed to change that function. std::strncpy(col, sql_backslash_to_underscore(col).c_str(), DB_MAX_TAB - 1);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This opens the directory, gets the directory size ok, but fails to read the directory. I don't know what can be done with the handle.

#include <windows.h>
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    HANDLE hFile = CreateFile("C:\\users", GENERIC_READ, FILE_SHARE_READ,
        0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
   if( hFile != INVALID_HANDLE_VALUE )
   {
        DWORD dwFileSize = GetFileSize(hFile, 0);
        DWORD dwBytesRead = 0;
        char* buf = new char[dwFileSize];
        ReadFile(hFile, buf, dwFileSize, &dwBytesRead, 0);
        if(dwBytesRead > 0)
        {
            cout << buf << "\0";
        }
        else
        {
            DWORD dwError = GetLastError();
            char tmp[255] = {0};
            FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwError, 0,
                tmp, sizeof(tmp), 0);
            cout << tmp << "\n";
        }
        delete[] buf;
        CloseFile(hFile);
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The password can not be verified, probably its just a fake username and password in the code your posted. You need to provide a valid user name and password -- but do NOT post them here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I downloaded and tried to compile Turbo Vision with VC++ 2008 Express IDE (not using the makefile), but didn't have much luck. Tried using the makefile for vc compilers and that failed too, but did much better than when I tried it with the IDE solution I created.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sir how can i add two fraction nos. to get again fraction
eg.
a/b+c/d=(ad+bc)/bd

I would be very happy if u send me code.

We are not in the business of doing homework free of charge. Add $1,000.00 USD to my pay pal account and I'll do it for you.

If you don't have that much money then just post the code you have tried and people here will help you out free of charge :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I am working on UNIX, and using CC to compile the code.

Wouldn't it be terminal dependent? something to do with termcap settings? (Just guessing, its been 15 or so years since I worked with *nix).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The United States Air Force REQUIRES all its computers to use Microsoft IE. Firefox is not even allowed to be installed on its computers except on developer's computers who are writing web apps for the general public to see and use.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, I misunderstood your code.

>>And what is your code supposed to do?
Nothing -- as you well stated. My post was just a brain fart.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably nothing wrong with Turbo Vision, but that's not the issue here. TVision is a library, not a compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post your program. Did you add the pdcursis.lib to your project? Project --> Properties --> Configuration Properties --> Linker --> Input

pdcurses contains several example programs that you might want to review to see how it works.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After entering an integer you have to flush the '\n' <Enter key> from the keyboard buffer. The easiest way to do that is cin.ignore(1000,'\n'); . Read this thread for more details.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Never tried it myself, but maybe this thread will help you. It contains some source code to call the GetPixel() function.

Salem commented: Push for R2K, you're lagging too far behind +34
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>while (in >> str) out << str << "-";

What??? That will not replace white spaces with '-' character.

while( in >> str)
{
    for(int i = 0; i < str.length(); i++)
    {
        if( isspace(str[i]) )
          str[i] = '_';
    }
    out << str << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you using VC++ 2005 Express? If yes do you have the Windows Platform SDK installed?

If you upgrade to VC++ 2008 Express you don't need that SDK. I am using 2008 and had not problems compiling/linking pdcurses.

tux4life commented: VC++ Expert!! +8
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>2- c:\>path = C:\pdcurs32\win32
DON'T DO THAT! because it will destroy the entire PATH environment variable. Instead, you need to run the vcvars32.bat batch file in the compiler's bin directory to set the compiler's DOS environment variables.

I copy vcvars32.bat file into the c:\ root directory to make it easier to access and run because the compiler's directory is just tooooo dam long (mine is the same place your is).

>>5- c:\pdcurs32\win32>vcwin32.mak -f nmake

That is wrong. c:\pdcurs32\win32>nmake -f vcwin32.mak

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So far I think everyone has mentioned English-speaking movies. How about non-English movies? Admittedly I don't normally watch them because I don't like reading the subtitles. I did enjoy "The Visitors" -- a French film. Had to watch it 4 or 5 times in order to catch all the dialog in the subtitles. I just wish there were an English version of that movie.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Those C functions may not work with huge files -- files that are larger than 2 gig. In MS-Windows win32 api functions would be needed to get the file size of huge files. I don't know about *nix or MAC

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>IOW, where'd you get your magic number of 900?

trial and error. It was actually about 912. Held down the star key until 900+ stars appeared then tried to compile. When the compiler crapped out I backed out a few stars until I got a clean compile/link. My guess is that the compiler pushes something on the stack for each star.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to Daniweb. Please post your question in the appropriate forum. Narue has written a detailed explanation in the C++ board about how to flush the input stream in c++ programs. See the sticky in that forum.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

fgets will return everything up to and including the newline. But the problem is, that a newline character's ASCII representation is system dependent.

Not in memory -- its always '\n' regardless of the operating system. Its just the file systems on physical hard drives that are different from one os to another. When working with text files fgets() will work the same on every operating system that supports that function. So the issues with the file systems isn't really relevant to the OPs question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The way I found out the limits was to write a program that had a pointer with a bunch of stars.

>>did you incrementally compile 1 additional indirection operator each time?

Suuuure I did, and compiled it over 900 times just for this thread. And if you believe that I have some stocks in the Golden Gate Bridge I'll sell you :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster


What I'd recommend is converting 'time.wday' et al to strings. Casting them should probably work.

Have you tried this?

// attempt to put date into a string
	std::string date = (std::string)time.wDay + "/" + (std::string)time.wMonth + "/" + (std::string)time.wYear;

.

Its not possible to cast an integer to a std::string.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <sstream>
#include <string>
#include <windows.h>
using namespace std;

string date()
{
   SYSTEMTIME stime;
   GetLocalTime(&stime);
   char buf[40] = {0};
   sprintf(buf,"%02d/%02d/%04d",
        stime.wDay, stime.wMonth, stime.wYear);
  string dt = buf;
  return dt;
}
JasonHippy commented: Cheers! You recscued the thread there, I was about to suggest a solution using ostringstream, but sprintf is way better! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want to reference header files in all your projects then select Tools -->Options --> Projects And Solutions --> C++ Directories, then add the paths in the window on the right side of the screen. After that all you have to do is something like #include <dm/something.h> if the header is in the dm subdirectory. You have to know what folder the header file is in because the compiler won't search subdirectories for you.


I don't know about your second question because I never look at those files. When I want to see an include file I just right click on the #include <...h> line and select Open Document from the popup window.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I assume you mean in MS-Windows operating system. You would not want to do that even if you could because it would not allow the user to easily select a different desktop icon, the start menu, or any of the icons in the desktop trey. And that would piss off your customers so bad that they would just delete your program, or maybe even sue you.

The only reason to write such a program is for malicious purposes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My favorite brand was Skippy until a few years ago because the peanut oil would float to the top in other brands. However now I have switched to Jif because it's not as dry tasting as Skippy, and spreads better.

peanut butter and jelly sandwitch -- yuuuuum :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I was asked some interesting validation questions like:
>>Creamy or Crunchy? I answered crunchy (you have to be pretty deep American to even understand the question).

What does that mean by-the-way ? :)

Peanut Butter

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why don't you just use one of the platform independent GUI 3d party libraries, such as wxWindows, GTK+, or QT. I think wxWindows and GTK+ will both work with VC++ 2008 Express (although I have not tried it). QT is its own IDE which works with nearly any 32-bit compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have you made your own programming language yet?
I'm doing a computing project for A2 coursework and creating your own language is one of the suggested options.
Is yours stack-based?
If you created your own how did you create it?

This thread is over 5 years old -- I doubt the OP will answer you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

With VC++ 2008 Express, compiling a C program, I was able to compile char*(500 stars) ptr = "Hello"; before the parser complained. And then the error message was "parser stack overflow, program too complex"

Interestingly, as a c++ program I was able to give it about 920 stars before the compiler crapped out -- then it was during the link stage, not the compile stage.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
static const char * sql_backslash_to_underscore(const char * key)
{
  if (!key) {
    ERROR0("got NULL key");
    return NULL;
  }
  char * dup = strdup(key);
  char* ptr;
  while( (ptr = strrchr(dup,'\\')) != NULL)
     *ptr = '_';
  return dup;
}

One problem with the above code is that the caller cannot call free() on a const char* that is returned by the above function. So unless you typecast to remove the const there will be a memory leak.

int main()
{

    const char* ptr = sql_backslash_to_underscore("acct\\username\\Program Files\\Debug");
    cout << ptr << "\n";
    free( (char*)ptr);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i am surprised that you say something can't be done.. nothing is impossible

I don't pretend to be God. Read this thread.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Gone With The Wind. Great 1939 epic about the Old South (USA) Civil War and the mixed-up love between four people. The most commonly quoted line in US today is: Rhett Butler said "Frankly, my dear, I don't give a damn."


Also anything directed by Cecil B. DeMille

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>you have to pass in an address

Not if you pass NULL.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Actually I use both IE8 and FF

jephthah commented: blasphemer! -2
scru commented: ... +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So the implementation code for the class is in the application program and not the DLL? Sounds backwards to me, and when compiling the DLL it is not possible for the compiler to resolve the class references. I think you need to redesign something and put the class implementation code either in the DLL or a lib that the DLL can link with. c++ classes can be easily exported from a DLL just like any other function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb :) We have quite a few members who are from India, including one of our moderators. Hope you enjoy your stay.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

could be that you didn't add the boost libraries to your program's project. Did you compile them after installing boost?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That operating system and compiler are you using? In my MS-DOS 6.X days I had no conflicts between serial port interrups and printf(). I just wrote a serial port driver (supported 1 to 40 serial ports) that was TSR and the rest of the program ran normally, within the memory constraints of MS-DOS.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is C::B ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

could someone please point me to a link on how to convert my char* temp = new char[3]; to a char test[3]?

Post code. Generally we would not allocate just 3 characters because it isn't worth the effort. But, like everything else, there are exceptions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I agree with Siddhant -- but you have to be careful of the code you use. For example I have used some MFC c++ code from codeproject.com in my production projects. One was an editable grid control for wireless devices running Mobile 5.0 and PocketPC which would have taken hundreds of manhours to duplicate.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

IMHO c++ for dummies is exactly that -- for dummies. There's an entire thread at the top of this forum about c++ books, you should read it.

For MS-Windows program all you need is a fundamental knowledge of C or C++ language. The win32 api does not require c++. Here is a good introduction.

UNICODE will not help you with superscripts or subscripts. To do that you have to use a different font, and required MS-Windows gui program. It can't be done with a console program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I do not understand what is happening here

Microsoft completely rewrote CString to convert it from a c++ class in VC++ 6.0 compiler to a template in VC++ 2005 and later compilers. There were lots of changes to MFC, and CString was just one of them. Consequently you may have to rewrite parts of your programs to conform to the new version of MFC.

colmcy1 commented: Thanks for your help +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how about this: return (d-1) < 0 ? North : d-1; No need for the mod operator.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I know of one library, but I don't know if it would fill your needs. DataReel This library contains a lot of code, but also client/server sockets with sample programs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The above code works right ??? Then whats the problem ? Why isn't this thread marked solved ?

Because the OP has not posted any code or made any other comments.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> while (infile) {
>> for(int i = 0; i < 900; i++) { // NOTE for i < 900 this is

Don't you see a problem with that code? What will happen if the file only contains 10 lines? Or 901 lines? There is no need for that for loop. Instead, just use variable i as a counter to index into arrays.