|
Jung Seng Won wrote: why that result come?
Because: Your file ends with an empty line and your program doesn't check fgets return value.
Change
Jung Seng Won wrote: fgets(data, sizeof(data)-1, fp);
fputs(data, stdout);
with
if( fgets(data, sizeof(data)-1, fp) )
fputs(data, stdout);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Assuming you're using C++ forget about all that C-style file manipulation bollocks and do something like the following:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream ifs("C:\\Data.txt");
if (!ifs)
{
cerr << "Failed to open file!" << endl;
return -1;
}
string line;
while (getline(ifs, line))
{
cout << line << endl;
}
return 0;
}
Easier to understand and no limit on the length of a line.
Steve
|
|
|
|
|
i am using ProEssentials v6 to draw stack bar graph
i want to use embended color when one color change to another how is that possible plzzzz help me , its necessory and urgent
if any other solution is possible plz tell me
i am using following code
void CVEPExplorer::CreateSimpleHighLowClose()
{
// This example builds upon the basic CreateSimpleGraph '000' example chart //
CreateSimpleGraph();
PEnset(m_hPE, PEP_bNOSTACKEDDATA, FALSE);
PEnset(m_hPE, PEP_nPLOTTINGMETHOD, PEGPM_BARSTACKED);
}
void CVEPExplorer::CreateSimpleGraph()
{
RECT rect;
CStatic *d=(CStatic*)GetDlgItem(IDC_BAR);
d->GetClientRect(&rect);
rect.top=38;
rect.left=25;
rect.bottom=272;
rect.right=310;
int nBarColor = PERGB( 32,128,256,0);
PEvsetcell(m_hPE, PEP_dwaSUBSETCOLORS, 3, &nBarColor);
m_hPE = PEcreate(PECONTROL_GRAPH, WS_VISIBLE, &rect, m_hWnd, 1);
if (m_hPE)
{
PEnset(m_hPE, PEP_nSUBSETS, 4);
PEnset(m_hPE, PEP_nPOINTS, 1);
float faYdata[4][1];
faYdata[0][0]=1.5;
faYdata[1][0]=0.5;
faYdata[2][0]=1;
faYdata[3][0]=2;
PEnset(m_hPE, PEP_fBARWIDTH,0.1);
srand( (unsigned)time( NULL ) );
for(int p=0;p<4;p++)
{
for(int f=0;f<1;f++)
{
PEvsetcellEx (m_hPE, PEP_faYDATA, f, p, &faYdata[p][f]);
}
}
float faXdata[1][1];
faXdata[0][0]=50;
PEreinitialize(m_hPE);
PEresetimage(m_hPE, 0, 0);
tagSGRAPHPROPERTIES a;
a.nCGridLineControl;
a.nCGridLineControl;
a.bAllowLine;
a.bAllowPoint;
PEnset(m_hPE,PEP_bALLOWLINE,FALSE);
PEnset(m_hPE,PEP_bALLOWPOINT,FALSE);
PEszset(m_hPE, PEP_szMAINTITLE, TEXT(""));
PEszset(m_hPE, PEP_szYAXISLABEL, TEXT(""));
PEszset(m_hPE, PEP_szXAXISLABEL, TEXT(""));
PEnset(m_hPE, PEP_bFOCALRECT, TRUE);
PEnset(m_hPE, PEP_bALLOWBAR, PEGPM_AREA);
PEnset(m_hPE, PEP_nGRIDLINECONTROL, PEGLC_NONE);
PEnset(m_hPE, PEP_bALLOWRIBBON, TRUE);
PEvsetcell( m_hPE, PEP_szaPOINTLABELS, 0, TEXT("SNR" ));
// subset colors //
DWORD dwArray[5] = {PERGB(0,198,25,25), PERGB(128,198,0,0), PERGB(128,0, 198, 198 ), PERGB(128,198,198,0 ), PERGB(128,0,198,0 ) };
PEvsetEx(m_hPE, PEP_dwaSUBSETCOLORS, 0, 5, dwArray, 0);
int nNoLegends = -1;
PEvset(m_hPE, PEP_naSUBSETSTOLEGEND, &nNoLegends, 1);
// subset point types //
// Allow stacked type graphs //
PEnset(m_hPE, PEP_bNOSTACKEDDATA, FALSE);
// Various other features //
PEnset(m_hPE, PEP_bFIXEDFONTS, TRUE);
PEnset(m_hPE, PEP_bBITMAPGRADIENTMODE, TRUE);
PEnset(m_hPE, PEP_nQUICKSTYLE, PEQS_MEDIUM_LINE);
PEnset(m_hPE, PEP_bSIMPLEPOINTLEGEND, TRUE);
PEnset(m_hPE, PEP_bSIMPLELINELEGEND, TRUE);
PEnset(m_hPE, PEP_nLEGENDSTYLE, PELS_1_LINE);
PEnset(m_hPE, PEP_nGRADIENTBARS, 8);
PEnset(m_hPE, PEP_nTEXTSHADOWS, PETS_BOLD_TEXT);
PEnset(m_hPE, PEP_bMAINTITLEBOLD, TRUE);
PEnset(m_hPE, PEP_bSUBTITLEBOLD, TRUE);
PEnset(m_hPE, PEP_bLABELBOLD, TRUE);
PEnset(m_hPE, PEP_bLINESHADOWS, TRUE);
PEnset(m_hPE, PEP_nFONTSIZE, PEFS_MEDIUM);
PEnset(m_hPE, PEP_nDATAPRECISION, 1);
PEnset(m_hPE, PEP_bMARKDATAPOINTS, TRUE);
PEnset(m_hPE, PEP_nGRIDSTYLE, PEGS_DOT);
// Improves metafile export //
//PEnset(m_hPE, PEP_nDPIX, 600);
//PEnset(m_hPE, PEP_nDPIY, 600);
//PEnset(m_hPE, PEP_nRENDERENGINE, PERE_GDIPLUS);*/
}
}
|
|
|
|
|
Hello all there,
I have made two avtivex controls to lie in web browser. and ruuning properly.
Now i want to communicate between these controls. I am able to do this by java script as intermediate.
But i dont want to include jave script at all.
So is there any way to do it directly?
Thanks in advance.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Hi all.
I have a character in English i.e "INBOX"
I want to change it to japenese
how can i..
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
What do you mean by "you want to change it to japanese"?
|
|
|
|
|
|
Hi! I have written a Clas in C++ but my professor wants me to turn in .h file instead of the whole program and i don't know exactly how to do it. Can anyone show me steps to create a .h file, please? Thank you. This is the program i have:
[code]
#include <iostream>
#include <string>
using namespace std;
class CCustomer
{
private:
string Card_number;
public:
string first_name;
string last_name;
string customer_ID;
CCustomer();//Default constructor
CCustomer(string, string, string, string);//Parameterized constructor
CCustomer(CCustomer&);//Copy constructor
void input();//Function to get inputs
void output();//Function to get outputs
void display();//To display the info of a customer
string getCard_number();//Accessor
void setCard_number (string Card_Num);//Mutator
};
void main()
{
CCustomer myself;
CCustomer yourself("Ravi", "Shah", "A123", "1111 2222 3333 4444");
yourself.output();
CCustomer name(yourself);
yourself.output();
myself.input ();
string myCardNum = myself.getCard_number();
myself.setCard_number ("1234 5678 1234 5678");
myself.output();
}
CCustomer::CCustomer()
{
first_name = "no name";
last_name = "no name";
customer_ID = "no info";
Card_number = ("0000 0000 0000 0000");
}
CCustomer::CCustomer(string f, string l, string id, string n)
{
first_name = f;
last_name = l;
customer_ID = id;
Card_number = n;
}
CCustomer::CCustomer(CCustomer& x)
{
first_name = x.first_name;
last_name = x.last_name;
customer_ID = x.customer_ID;
setCard_number(x.getCard_number());
}
void CCustomer::input()
{
cout << "Please enter your first name, last name, customer ID, and card number each" << endl;
cout << "seperated by space, then press enter ";
cin >> first_name
>> last_name
>> customer_ID
>> Card_number;
setCard_number(Card_number);
}
void CCustomer::output()
{
cout << "First name: " << first_name << endl;
cout << "Last name: " << last_name << endl;
cout << "Customer ID: " << customer_ID << endl;
cout << "Card number: " << getCard_number() << endl;
}
void CCustomer::display()
{
cout << first_name << ' ' << last_name << ' ' << customer_ID << ' ' << getCard_number() << endl;
}
string CCustomer::getCard_number()
{
return Card_number;
}
void CCustomer::setCard_number (string Card_Num)
{
Card_number = Card_Num;
}[/code]
|
|
|
|
|
The very first code block would be your .h file.
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
My professor told me i would have to CREATE .h file. What would i put in .h file? Can you tell me what should i put in .h file from the code i posted?please.
|
|
|
|
|
#include <iostream>
#include <string>
using namespace std;
class CCustomer
{
private:
string Card_number;
public:
string first_name;
string last_name;
string customer_ID;
CCustomer();
CCustomer(string, string, string, string);
CCustomer(CCustomer& [Wink] ;
void input();
void output();
void display();
string getCard_number();
void setCard_number (string Card_Num);
};
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Don't forget the include guards:
#ifndef MYFILE_H
#define MYFILE_H
#endif
(or a #pragma once at the top of the file for MS compilers).
|
|
|
|
|
Cut the declarations from implementation file(.cpp file) and give those in the declaration file.
i.e ur header should contain the following:
class CCustomer
{
private:
string Card_number;
public:
string first_name;
string last_name;
string customer_ID;
CCustomer();
CCustomer(string, string, string, string);
CCustomer(CCustomer&;
void input();
void output();
void display();
string getCard_number();
void setCard_number (string Card_Num);
};
|
|
|
|
|
Hi write the following class and declared variable and functions in the ClassName.h file
class CCustomer
{
private:
string Card_number;
public:
string first_name;
string last_name;
string customer_ID;
CCustomer();//Default constructor
CCustomer(string, string, string, string);//Parameterized constructor
CCustomer(CCustomer& [Wink] ;//Copy constructor
void input();//Function to get inputs
void output();//Function to get outputs
void display();//To display the info of a customer
string getCard_number();//Accessor
void setCard_number (string Card_Num);//Mutator
};
and include the .h file in ClassName.CPP file as #include "ClassName.h"
and
write the main function in .cpp
it will work.
Dont forget to rate
|
|
|
|
|
Hi!
I've developed an application in C++. My program compile and links fine. When I run the application, the application window opens and closes in a sudden. It displays the following message in the output window:
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\msvcr80.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2\msvcp80.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgDB.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\xerces-c_2_8.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtCore.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\ode.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgGA.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgUtil.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgViewer.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgText.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgParticle.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtABC.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtDAL.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtAI.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\rcfgscript.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\rvrutils.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtAnim.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtGame.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgSim.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\cal3d.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\avgrsstx.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\nvoglnt.dll', No symbols loaded.
The thread 'Win32 Thread' (0xc28) has exited with code 0 (0x0).
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', No symbols loaded.
'CharacterAnimation.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtActors.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\bin\dtAudio.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\alut.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\OpenAL32.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osgdb_ive.dll', Binary was not built with debug information.
'CharacterAnimation.exe': Loaded 'C:\Program Files\Delta3D_REL-2.0.0\ext\bin\osg25-osgFX.dll', Binary was not built with debug information.
The program '[2268] CharacterAnimation.exe: Native' has exited with code 1 (0x1).
|
|
|
|
|
And what's the problem ? That's perfectly normal behavior to have those lines displayed.
T.RATHA KRISHNAN wrote: When I run the application, the application window opens and closes in a sudden
Did you try debugging to see what it's doing ?
|
|
|
|
|
I could not see what the application window displays(i.e. it opens and closes in a sudden). The output window displays,"The program '[3148] CharacterAnimation.exe: Native' has exited with code 1 (0x1)." What to do?
|
|
|
|
|
T.RATHA KRISHNAN wrote: What to do?
I already told you: use your debugger to see what the program is doing.
|
|
|
|
|
Usually, when an application closes without giving any error message, it's due to a stack overflow.
This may indicate infinite recursion.
You should single step the program in the debugger to find the cause.
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Hi,
As he told the application is exit with code 1.
It means the application successfully run.
i have looked into your debug information which looks fine to me.
|
|
|
|
|
Doesn't success == 0 ?
1 means some error.
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
No, you can return whatever code you like for your application (for a console app for example, you can return something from your main).
|
|
|
|
|
T.RATHA KRISHNAN wrote: When I run the application, the application window opens and closes in a sudden. It displays the following message in the output window
Is it not what is expected to do?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
This error comes when i enter long string in edit box and save in database.
I m using Access database and ODBC system dsn for connection.
Please help me for this.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
This most likely means that your string is too long for the database column.
Either make the database field larger, or make the data smaller.
In Access, I think the text fields are limited to 255 chars. To put in a longer string, you must use a memo field.
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|