|
In the WriteBuffer() method, does TextToWrite and Text contain the correct value?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello. I'm a absolute beginner at programming, but have a final class project that I'd like to begin working on nice and early. What I'd like to build is a Visual C++ program that will:
1. Take user input from a windows gui (text boxes, drop down menus, etc.)
2. Insert the input into the appropriate locations in existing html templates
3. Create new html pages based on the templates that have the users input added
4. Save the page(s) within a folder named something the user chooses, and have this folder located in a "projects" or "websites" directory where they can then access the folders/files and upload them to their server.
During this process the existing templates should not be overwritten either.
I've been able to create a very basic html page from console input using <ofstream> and "getline", but it requires mixing all the html tags with the c++ in the .cpp file. It's just messy and cumbersome. I know there must be a more efficient and elegant way of doing this that keeps the html separate from the c++, but at my beginner level I just don't know where to start. Hopefully someone here will have some insight and can give me some tips.
Thanks in advance.
-- modified at 15:37 Tuesday 13th June, 2006
|
|
|
|
|
Have you learned about SDI and/or MDI document view architecture yet?
There are several classes that deal with this.
Document Templates:
- CSingleDocTemplate
- CMultiDocTemplate
Views:
- CRichEditView (CRichEdit)
- CEditView (CEdit)
- CHtmlView (WebBrowser control)
Using, for example, the CRichEditView class you can open a file (text) regardless of the extension (.txt,.html,.xml), and load the file in the view. You can then edit it and "save as" a different filename.
mytmpl.html --> index.html
Using the CDocument class you can programatically save the document as a different name. I wouldn't get too far a head of the class though. You may be learning this near the end of the class anyway.
Mark
|
|
|
|
|
Hi want to know how to open a txt file in NotePad.exe using a button in my C++ app
and i want to know how can i read the current time/date and put them in a CString
Thans
|
|
|
|
|
Take a look at ShellExecute() for launching programs.
ShellExecute(NULL, "open", "mytest.txt", NULL, NULL, SW_SHOWDEFAULT);
Look at CTime class for data and time functions. An example of how you could use it:
CTime curtime = CTime::GetCurrentTime();
CString s = curtime.Format("%m/%d/%y %H:%M:%S p");
Mark
-- modified at 17:40 Tuesday 13th June, 2006
|
|
|
|
|
|
Mahhouraaaaaa wrote: Hi want to know how to open a txt file in NotePad.exe using a button in my C++ app
and i want to know how can i read the current time/date and put them in a CString
See CreateProcess(...) API
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi !!!
I have new forum.
If you want you can register you at this link:
http://cppmasters.iphpbb.com
I take everyone in my forum !!!
Thanks.
-:KNOX:-
|
|
|
|
|
hello i want to write some lines into a Cfile ( text file ) but i cant create a new line using "\n" what should i do ...
i think i must search for the VbCrlf equivalent in C++
thanx for your help
|
|
|
|
|
|
Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuu !!!!!!!!!!!!!
|
|
|
|
|
Mahhouraaaaaa wrote: youuuuuuuuuuuuuuuuuuuuuuuuuuuuuu !!!!!!!!!!!!!
Mahhouraaaaaa
Is there any problem in keyboard???
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
consider the following declaration on top of a.cpp
#include "mydefines.h"
const GUID FAR DetectionGuids[] =
{
// GUID 1
{ 0x4C4089A5, 0x7705, 0x9999, {0x11, 0x15, 0x20, 0x80, 0x9F, 0xa2, 0xa4, 0x94} } ,
// Add new GUID here
};
inside mydefines.h
I have
DEFINE_GUID(GUID_CLASS_CUSTOM, 0x44C4089A5, 0x7705, 0x9999, 0x11, 0x15, 0x20, 0x80, 0x9F, 0xa2, 0xa4, 0x94);
Now the above declaration shows a compiler error when i try
const GUID FAR DetectionGuids[] =
{
// GUID 1
GUID_CLASS_CUSTOM
// Add new GUID here
};
it gives me a message saying that it cannot convert from const struct _GUID to unsigned long
Any ideas ?
|
|
|
|
|
Hi
I have 2 PCs on a network (with shared hard drives, but not mapped). I wish to access the hard drive of Machine_2 from Machine_1 from within my Visual C app - can this be done without mapping the hard drives?
From Machine_1, I have tried opening "\\Machine_2\C\MyFolder\MyFile.txt", but I am unable to locate the file - am I doing something wrong, or this simply cannot be done?
Hope someone out there can help!
Thanks
Mike
|
|
|
|
|
69 Bay wrote: can this be done without mapping the hard drives?
Certainly, just use UNC.
69 Bay wrote: From Machine_1, I have tried opening "\\Machine_2\C\MyFolder\MyFile.txt", but I am unable to locate the file - am I doing something wrong, or this simply cannot be done?
What does the actual code snippet look like? Shouldn't that be C$ instead (assuming you are wanting to go through the administrative share)?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for looking
I am experimenting at the moment and using :
FILE *fMyFile;
fMyFile = fopen("\\\\Machine_2\\C\\MyFolder\\MyFile.txt", "r");
if(fMyFile!=NULL)
fclose(fMyFile);
Each time I try this, fMyFile comes back as NULL !
Thanks again
Mike
|
|
|
|
|
69 Bay wrote: fMyFile = fopen("\\\\Machine_2\\C\\MyFolder\\MyFile.txt", "r");
...
Each time I try this, fMyFile comes back as NULL !
Because you are not using C$ like I mentioned, unless you actually have a share on Machine_2 named C.
What is the value of errno when fopen() fails?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
I am a d**khead!
I just realised that the shared hard drive on Machine_2 was not shared as "C", but as "Mikes C"
Changing my app to this has got it working!
Thanks for your help
I will check more thoroughly before asking again!
Mike
|
|
|
|
|
If Machine_2 is not "resolveable" then this will fail.
You can put the entry in your "HOSTS" file (Not really ideal)
or
You can put an entry in your domain's DNS server(s) and make sure it is the first DNS server the machines hit and "forward" unresolveable requests to outside DNS servers for those non-intranet thingy's like yahoo.com, msn.com, etc... (preferable for deployments as changing server IP's simply requires a change in the DNS entry at the server(s))
or
put the IP directly in place of the computer name in the UNC path (best for testing)
\\192.168.50.50\C\MyFolder\MyFile.txt
-- modified at 12:09 Tuesday 13th June, 2006
Also, don't forget about the "rights" issues that come into play
|
|
|
|
|
Hi
I am a d**khead!
I just realised that the shared hard drive on Machine_2 was not shared as "C", but as "Mikes C"
Changing my app to this has got it working!
Thanks for your help
I will check more thoroughly before asking again!
Mike
|
|
|
|
|
I have this:
<br />
POSITION rpPos ;<br />
<br />
rpPos = pDoc->GetFirstViewPosition();<br />
while (rpPos != NULL)<br />
{<br />
pView = (CView1 *)pDoc->GetNextView(rpPos);<br />
}<br />
How do I know which View I am in? Is there any way
of displaying rpPos and knowing from that which view
I am currently in?
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
their are several ways, see CObject::IsKindOf(...)
you might consider designing your own solution.
|
|
|
|
|
led mike wrote: you might consider designing your own solution.
How does wanting to know what view is in a list have to do with designing one's own solution?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I meant eliminate the use of RTTI or CObjects version of it to identify the "type" of "view". My post was not clear at all, my bad.
|
|
|
|
|
Hi,
I have an application, in which I run a thread when the application loads. This thread calls a certain function that initializes an array, and takes a few minutes to run. The thread works good, but if I close the application before the thread is done then there is an assertion.
How can I overcome this? Can I maybe force the thread to end if the user closed the application before it finished?
|
|
|
|