|
I'm trying to use two functions to print to the screen a letter from the alphabet or my name using asterisk * characters. Does anyone know how to do it?
none
|
|
|
|
|
This is the Managed C++ forum.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi,
I am new to C++ programming. I am using the following code to check if a file exists, if not then create a new file and input something into the file.
the code runs well for the first time and creates the file as desired, however if the file created is manually deleted from the specified directory then the file is no longer created. I don't why ????????
Appreciate any help in this regard
ifstream dbfile("/var/puremail/tmp/pm_db_down.txt");
if (!dbfile.is_open()) {
cout << "The file does not exist. Creating a new file" << endl;
ofstream dbfile ("/var/puremail/tmp/pm_db_down.txt");
dbfile << puremail.m_getTime << endl;
dbfile.close();
exit(2);
}
else {
// read the file and calculate the time for which the db is down
}
when this code is run for the first time the file was created and also the time was written into the file, however after deleting the dbfile if I again run the code, the file is no more created.
Appreciate any help in this regard.
Thanks,
Mohit.
|
|
|
|
|
Wrong forum.
In Managed .NET C++, you would do things entirely differently.
But, your code example is not that complicated. You don't indicate how the file was created in the first place. It could be pre-existing, created by another application, or any one of a number of different methods.
|
|
|
|
|
how to import jpg format file in c++
any ides,if yes will be highly appreciated
|
|
|
|
|
It's even easier than in Visual C++ version 6.
I assume you want to display this image (on a Form).
First create a Graphics object, using the new operator.
Then call DrawImage->FromFile (this function has numerous overloaded forms an will accept a .jpg format image file).
Then, if the application compiles, your .jpg file must reside in ther same directory as the executable.
You can read all about these techniques either in your Microsoft Visual C++ .NET documentation. or, go over to the MSDN site and search.
|
|
|
|
|
how to revolve a circle in graphics also a line too.getting real problem!please kindly help me!
|
|
|
|
|
Do you want to animate a Form display?
Or what?
|
|
|
|
|
thank u for the replies i want to animate and make me much ckear about the importing .jpgs is graphics
|
|
|
|
|
|
hi... im having errors in managed c++(its the c++ in vs.net right?)..
c:\Documents and Settings\pc\Desktop\link41b\src\error.c(30): error C2051: case expression not constant
c:\Documents and Settings\pc\Desktop\link41b\src\error.c(30): error C2065: 'NODICT' : undeclared identifier
i hope you can help me with this.. thanks guys
|
|
|
|
|
Look at line 30 in error.c file; it's probably a typographical error.
If not, post the code segment.
|
|
|
|
|
I coded a bubble sort (below) and it works when I run it through Visual C++ but when I open it manually in XP the window opens and lets the user enter data and it quits quickly afterwards without displaying the output.
#include <iostream>
#include <iomanip>
using namespace std;
//Macro for max size of array
#define MAX 50
int Array[MAX];
int main()
{
cout << "\n----------------BINARY SORT ALGORITHM-------------------\n" << endl;
//Code for entering data into array
cout << "Enter up to " << MAX << " integers. " << "(Quit with any letter):\n" << endl;
for(int i = 0; i < MAX && cin >> Array[i]; ++i)
;
int ArraySize = i;
//Display Array
cout << "\nArray Size:- " << ArraySize << "\n" << "\nArray:- ";
for(int ii = 0; ii < ArraySize; ii++)
{
cout << setw(5) << Array[ii];
}
cout << "\n\n";
//Flag to show if sorted or not
bool Sorted = false;
//Temporary store whilt swapping
int Swap;
while( !Sorted )
{
Sorted = true;
for(int iii = 0; iii < ArraySize; ++iii)
{
if( Array[iii] > Array[iii + 1])
{
//Prints out current state of array
for(int j = 0; j < ArraySize + 1; j++)
cout << setw(5) << Array[j];
//Swapping code
Swap = Array[iii];
Array[iii] = Array[iii + 1];
Array[iii + 1] = Swap;
cout << "\n";
//Flag false since swapping occured
Sorted = false;
}
}
}
//Output
cout << "\n\n" << "SORTED LIST\n";
//Counter in the loop and condition are adjusted to ignore first element which is always 0 and to include last element
for(int iiii = 1; iiii < ArraySize + 1; iiii++)
cout << setw(5) << Array[iiii];
cout << "\n\n" << endl;
return 0;
}
Thanks
|
|
|
|
|
I am trying to register my COM interface via Regasm tools.
It returns error: RegAsm error: Unverifiable image 'MyService.exe' can not be run.
How can I register it?
Pls, help.
Thanks!
|
|
|
|
|
Hallo,Before all i want to say sorry to my poor english.
I'm little new in this kind of develop like C++, and i'm trying to do a client server in visual c++ where i have to do a connection with the login of one user that previous is registered (but it's not my problem).When i have the user login, with this user i have to send the information to the server and the server will say me what access i have, like if i have access to different devices like USB, cd-Rom,..( it's my real problem, how can i restrict the different kind of devices?) or what files have i access to download to my client and i think that here i have to implement Encrypt of files.
Somebody can say me how can i do this or which libraries can i use or a idea of like implement this problem.
Thank you very much and i hope that you can help me.
Jörge
|
|
|
|
|
How can I send an escape sequence to the printer?
I'm working with the C++ Builder and the VCL is not supporting escape sequences.
So I tried these snippet
char Help[1024];
sprintf(Help, "\x00c"); // escape sequnce for form feed
Escape(printer->Canvas->Handle,
PASSTHROUGH,
sizeof(Help),
Help,
NULL);
But the printer is not doing anything.
Thanks for your help!
----
Sorry that I posted the question to a wrong article already
|
|
|
|
|
I don't believe that C++ Builder supports managed C++
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
does anyone here have a managed c++ sentence parser? i just need it... i have a sentence parser in c++, but i dont know how to convert it into managed c++, does anyone here know how to do it?
thanks for your replies
|
|
|
|
|
Well, the following works in C#:
static void Main(string[] args)
{
string myString = "Just words, please.";
char [] seperators = {' ', ',', '.', '?'};
int startPos = 0;
int endPos = 0;
do
{
endPos = myString.IndexOfAny(seperators, startPos);
if(endPos == -1)
{
endPos = myString.Length;
}
if(endPos != startPos)
{
Console.WriteLine(myString.Substring(startPos, (endPos-startPos)));
}
startPos = (endPos + 1);
} while (startPos < myString.Length);
}
And you can get a C# string in C++ as follows:
#pragma push_macro("new")
#undef new
String* str = new String(S"Just words, please.");
#pragma pop_macro("new")
There must be a way to put them together.
Good luck.
Sincerely,
-Ron
|
|
|
|
|
thanks... ill try to use this... i hope i can.. hehe..
|
|
|
|
|
Hi, I am building a Testing tool using C++.net for college. I need to
get a very accurate measurement of a c functions execution time.
Currently I am running the function as real-time process and using the
QueryPerformanceCounter to measure its time, however this is still not
very accurate (between 1 and 5% inaccuracy). Any ideas on how to
improve this would be much appreciated.
|
|
|
|
|
I was recently messing around with this approach, and I found the results to be unverifiable. I was using the high fidelity system time stamp retrieved from a CounterSample (I suspect that you did something similar). The MSDN documentation states that the timestamp has an accuracy of a tenth of a millesecond.
I found this article over in the MSDN Magazine archives, maybe it will help:
http://msdn.microsoft.com/msdnmag/issues/04/03/HighResolutionTimer/default.aspx[^]
|
|
|
|
|
LARGE_INTEGER startCount, endCount, freq;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&startCount);
YourFunc();
QueryPerformanceCounter(&endCount);
printf("Elapsed time = %lf", (double)(endCount-startCount)/freq);
|
|
|
|
|
Is is possible to create an object that inheriets from a MFC object in .NET?
|
|
|
|
|