|
|
Hi!
I am a beginner and I have a problem!
I am using the DHTML edit control to let the user enter his/her text. After that he or she clicks on a button and this calls a function. I managed to write a function which reads the text line by line, adds infront of and after each line a Document.write(' and ') and saves it on a file. Well my program works fine if the user writes only one line but if it writes more than one my code doesnt work fine any more because it adds the ') after making a new line!
The users entry just like on the control:
Hi! I am your user.
How are you?
And my program makes this (it can make it correctly if there is only one line to render!):
document.write('Hi! I am your user
')
document.write('How are you?
')
and a webpage with a javascript code like this gives an "undetermined string blabla error!".
Why does it puts the ') after making a newline? Does the dhtml control add something to the text to signal a newline or .....? very
Can someone help me?
please....
Thank you for your future answers!
|
|
|
|
|
What function are you using to read each line from the edit control?
|
|
|
|
|
for example, student is a struct, student *std is defined in class CApp. how can I use std in class CDlg?
thanks!;P
|
|
|
|
|
Have a third class which holds this information, and query it from both of your original classes.
Or, have a global instance of the structure, and reference it using EXTERN CAPP::STUDENT *std
|
|
|
|
|
thank you very much!! i solved it !
|
|
|
|
|
Ok, an instance of the student struct is owned by your CApp object. Yes? Does the CApp object also own the instance of CDlg? If so, when the CApp object creates the CDlg object, it can pass a pointer to the student struct in CDlg's constructor.
|
|
|
|
|
I'm trying to pass a vector (of strings) by reference into a function that returns the vector of strings.
I have
vector<string> combovectorwrite(vector<string> $values, int val_num)
vector<string> is the return type, combovector is the name of the function, vector<string> $values is the name/definition of vector i'm passing into the function.
i've tried doing this before and failed miserably, i haven't yet figured out a way to do it. anyone have any tips?
|
|
|
|
|
Are you using STL?
For STL you would do:
vector<string> combovectorwrite(vector<string>& values, int val_num)
{
vector<string> resultantVector;
return resultantVector;
}
Is that what you were looking for?
-Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
thanks. for some reason, i had something similar to that but it didnt work.
|
|
|
|
|
I built a simple Win32 program but it gives me the following message...I'm not sure what's wrong. I did the same program before and it worked, now something went wrong.
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Program_1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Program_1.exe - 2 error(s), 0 warning(s)
|
|
|
|
|
try this : http://www.cryer.co.uk/brian/mswinswdev/msdev_lnk2001ueswm.htm
also, did you create an empty, win32 console application when you created the project?
|
|
|
|
|
Check the libraries you added to your project. You might have made a mistake while adding one.
|
|
|
|
|
check the link property sheet in the Project settings dialog box,
to see if something go wrong with the /subsystem: option.
Just a try. May u good luck.
|
|
|
|
|
I succefully compiled a small program in VC++. However, when I built the final edition in release mode, it doesn't work properly. When I run the stand alone .exe program, it pops up for a split second and then vanishes off my desktop screen. It's a consoloe application. Why might this be happening?
Thanks
|
|
|
|
|
The console closes itself when it has finished its job.
Put a "getc()" command at the end of your program to wait for
a user input before closing the application.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I tried to use the "getc()" but kept getting all kinds of error messages, I'm not sure hoe to implement it? Starnge thing is that I';ve made console programs before and I've not had this program, eg. the following program should ask me to press any key before ending the program...
#include <iostream>
using namespace std;
int main()
{
cout
<<"hello World!"<
|
|
|
|
|
Maybe VC++ keeps the window open until you, the user or programmer, close it.
Try right-clicking on your built .exe and chose to edit the properties. Make
sure that on the program tab "Close at end of execution" (or sth. like that... I don't know the real English expression -- I've got a German Win version) is NOT checked. You can also test your program in the console. If it works properly in there, this should just be one of Win's .. well... failures.
|
|
|
|
|
pf7 is correct. if a program is complete, if you just run the executable, the program will close itself. however, VS.net forces the progeram window to remain open until you close it (press any key to continue...)
you can add
_getch();
to your program, i beleive you need #include <conio.h> to use it. put _getch() at the end of the program to force a key press before th window closes.
|
|
|
|
|
Well my answer may be stupid. Excuse me because I am a beginner but try putting this at the end of your code before the "return":
int a;
cin >> a;
Your program wont close until the user presses "enter".
|
|
|
|
|
CString strFileDirs = "dirs.data";<br />
char szBuf[_MAX_PATH];<br />
<br />
TRY {<br />
CStdioFile fileDirs(strFileDirs, CFile::modeRead);<br />
while(fileDirs.ReadString(szBuf, _MAX_PATH)){<br />
ULONGLONG dwSavedPos = 0;<br />
dwSavedPos = fileDirs.GetPosition();<br />
<br />
TRACE("seek: %u\n", dwSavedPos);
fileDirs.SeekToBegin();<br />
fileDirs.Seek(dwSavedPos, CFile::begin);
}<br />
fileDirs.Close();<br />
}<br />
CATCH (CFileException, pE) {<br />
pE->ReportError(MB_ICONSTOP, IDS_FILE_ERROR);<br />
}<br />
END_CATCH<br />
What I'm doing wrong?
|
|
|
|
|
Use TRACE("seek: %I64u\n", dwSavedPos) instead.
|
|
|
|
|
|
What about:
DWORD dwSavedPos = fileDirs.GetPosition();<br />
TRACE("seek: %lu\n", dwSavedPos);
|
|
|
|
|
and compiler warns about bad type conversion.
My system is default Win2000 and VS .NET installation.
And I dont use any external include dirs all is just from default install.
|
|
|
|