golfinguy4 - my point exactly! (Read one of the threads about ASM if you dont understand) What he should have done was use as many C++ libary functions as possible, this maintains code (code not executible) portability.
golfinguy4 - my point exactly! (Read one of the threads about ASM if you dont understand) What he should have done was use as many C++ libary functions as possible, this maintains code (code not executible) portability.
VC++ 6
I don't write functions like that so avoid using the win api. I have no gripes about overhead or speed when it comes to IO on any operating system. However, why write something you'll just need to re-write later. I think one advantage to making portable code that no-one really talks about is that I can get programming help from a Unix message board. I really don't care if fopen, fclose, fread, fwrite, read, write, creat, open, and close all use the api (which would make sense since they interface with the actual operating system) they get the job done without me needing to look in the Windows SDK manual every time I need to use them.
Yes but the fundemental goal was to display data in an editbox......therefore his code cannot be portable.....Originally posted by VBprogrammer
golfinguy4 - my point exactly! (Read one of the threads about ASM if you dont understand) What he should have done was use as many C++ libary functions as possible, this maintains code (code not executible) portability.
Fordy is right to some extent. But once again, portable doesn't necessarily mean you take windows source code and compile it to linux. It means I that one doesn't need to spend 5 hours changing window's specific calls to linux specific calls. I think people have a personal preference when it comes to making portable code. The way I look at is that one day microsoft may crumble and we are all using some new operating system. Some of us will be able to take our code and with little changes be able to re-use it. Others will have to start over from the top. I make portable code so I can make open source projects that other platforms can use.
Another interersting angle.......if I develop a commercial app for windows, and I lose the source......would I want it to be easily ported to *nix?....dont think so....Originally posted by master5001
Fordy is right to some extent. But once again, portable doesn't necessarily mean you take windows source code and compile it to linux. It means I that one doesn't need to spend 5 hours changing window's specific calls to linux specific calls. I think people have a personal preference when it comes to making portable code. The way I look at is that one day microsoft may crumble and we are all using some new operating system. Some of us will be able to take our code and with little changes be able to re-use it. Others will have to start over from the top. I make portable code so I can make open source projects that other platforms can use.
Okay, I got it working to open a file and put the text in the edit, but now how would I take the text and save it to a file? Thanks, fellas!
1978 Silver Anniversary Corvette
Send Messages EM_GETTEXTLENGTHEX & EM_GETTEXTEX To get the text...then WriteFile();Originally posted by Garfield
Okay, I got it working to open a file and put the text in the edit, but now how would I take the text and save it to a file? Thanks, fellas!
Fordy, what are the parameter specifics of those messages? This bothers me. Is there any place that I can get the SDK CD for free? I need these documentations...
1978 Silver Anniversary Corvette
I have a question regarding this code
This works fine when I am using it to open smaller files. In fact it has worked on ASCII files up to 1.8 Mb large. When I tried a 4 Mb ASCII file it failed. I debugged and found it was failing at if(dwFileSize != 0xFFFFFFFF). Is this way limited by the size of the file? I am not using an edit control by the way I am using a richedit control.Code:hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if(hFile != INVALID_HANDLE_VALUE) { DWORD dwFileSize; dwFileSize = GetFileSize(hFile, NULL); if(dwFileSize != 0xFFFFFFFF) { LPSTR FileText; SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Opening..."); FileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1); if(FileText != NULL) { DWORD dwRead; if(ReadFile(hFile, FileText, dwFileSize, &dwRead, NULL)) { FileText[dwFileSize] = 0; // Set the NULL terminator SetWindowText(hEdit, FileText); } GlobalFree(FileText); } } CloseHandle(hFile); SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)"Ready..."); char WindowText[256]; strcpy(WindowText, "NotepadX -- "); strcat(WindowText, FileName); SetWindowText(hwnd, WindowText); } }
- Sean
If cities were built like software is built, the first woodpecker to come along would level civilization.
Black Frog Studios
Info hereOriginally posted by Garfield
Fordy, what are the parameter specifics of those messages? This bothers me. Is there any place that I can get the SDK CD for free? I need these documentations...
Yeah, I remember that thread, but I can't always go online to look up a function or some other stuff, so what's why I would need the CD. Anywhere?
1978 Silver Anniversary Corvette
Originally posted by Garfield
Yeah, I remember that thread, but I can't always go online to look up a function or some other stuff, so what's why I would need the CD. Anywhere?
No Garf...the link given by Robert602 allows you to go and download the docs of the SDK.....this is very much like the MSDN you get with VC++....except its more up to date and doesnt have any std lib functions (but all documented APIs are in there).....
Fordy, do I want to install the Core SDK or the Windows installer SDK? Thanks...
1978 Silver Anniversary Corvette
I would get the core SDK...it will have the new libs and includes......add them to your options->directories in VC++ and you can use the newly defined functions....Originally posted by Garfield
Fordy, do I want to install the Core SDK or the Windows installer SDK? Thanks...
Yeah, I pretty much just need them for reference on params and the such...
1978 Silver Anniversary Corvette