|
<br />
#include <iostream><br />
using namespace std;<br />
char a = 'a';<br />
int b = 38273;<br />
double c = 9382;<br />
char * d = "hello";<br />
cout << a << " " << b << " " << c << d << endl;<br />
---------------------------------------------------------------------------
<br />
#include "stdafx.h"<br />
#include <windows.h><br />
#include <iostream><br />
using namespace std;<br />
int main(int argc, _TCHAR* argv[])<br />
{<br />
char * OurBuffer = new char[2048];<br />
FILE * FileHandle;<br />
cout << "Reading from C:\\BOOT.INI, using a " <br />
<< ( sizeof(char) * 2048 ) <br />
<< " byte buffer." <br />
<< endl;<br />
cout << "Now displaying the file as it is read line by line." <br />
<< endl;<br />
FileHandle = fopen( "c:\\boot.ini", "r" );<br />
while( OurBuffer[0] != 0 )<br />
{<br />
OurBuffer[0] = 0;<br />
fgets( OurBuffer, 2048 * sizeof(char), FileHandle );<br />
cout << OurBuffer;<br />
}<br />
return 0;<br />
}<br />
---------------------------------------------------------------------------
<br />
Get a string from a stream.<br />
<br />
char *fgets( <br />
char *string,<br />
int n,<br />
FILE *stream <br />
);<br />
wchar_t *fgetws( <br />
wchar_t *string,<br />
int n,<br />
FILE *stream <br />
);<br />
Parameters<br />
string <br />
Storage location for data. <br />
n <br />
Maximum number of characters to read. <br />
stream <br />
Pointer to FILE structure. <br />
Return Value<br />
Each of these functions returns string. NULL is returned to indicate an error or an end-of-file condition. Use feof or ferror to determine whether an error occurred.<br />
---------------------------------------------------------------------------
<br />
Open a file.<br />
<br />
FILE *fopen( <br />
const char *filename,<br />
const char *mode <br />
);<br />
FILE *_wfopen( <br />
const wchar_t *filename,<br />
const wchar_t *mode <br />
);<br />
Parameters<br />
filename <br />
Filename. <br />
mode <br />
Type of access permitted. <br />
Return Value<br />
Each of these functions returns a pointer to the open file. A null pointer value indicates an error. <br />
----------------------------------------------------------------------------------------<br />
|
|
|
|
|
helloo...
this is my first post....
i wonder the differences between borland c++builder with c++ in general???
may you tell me where can i download trial version of borland c++ 6 enterprise edition??
thank's
any suggestion n answer is appreciated..........
|
|
|
|
|
I am trying to print from a richTextBox in Managed C++, but I can't figure out how to pront the formatting with the text. I tried making a streamreader and inputting the text, but I got an error that the streamreader can't be over 240 chars or something. I am also affraid that if I get this to work, it won't take into account all of the formatting. Hopefully someone can help.
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Hi Dear...
I struck in a problem & I know you can help me..
I've a pro-merchant account in amazon..& I want to upload Inventory to amazon.. but getting problem..File Error..even from site upload...
Can you send me Execl file you used for that uploading...
+ if possible some coding snippet of uploading invenorty. I want to upload through coding.. send me at:
sumit_kapoor1980@hotmail.com
or chat with me at hotmail account or yahoo: sumit_kapoor1980@yahoo.com
I hope you will help me..
Thanks
Have a Nice Life..
Sumit Kapoor.
---Sumit Kapoor---
|
|
|
|
|
Can any one tell me how can I detect keyboard whenever it is unplugged?
Any hint !!!
|
|
|
|
|
I need a good compiler... Preferably for Win32... I am noob..
|
|
|
|
|
|
Check out http://www.openwatcom.org
|
|
|
|
|
hi all,
i am doing a project which involves reading the message inside msm messenger
can someone have the idea how to get the text from the DirectUIHWND class in the msm conversation window
|
|
|
|
|
hi all,
here is my problem
i want to call a api(ReadFile) fucnction which return the byte array . how i have to declare and pass variables from managed c++.
|
|
|
|
|
There are two ways you can call ReadFile:
First way:
import the function:
[DllImport(S"Kernel32.dll", EntryPoint="ReadFile", CharSet=CharSet::Auto)]<br />
extern "C" Boolean ReadFileNative(IntPtr hFile,StringBuilder *lpBuffer,<br />
UInt32 nNumberOfBytesToRead,<br />
UInt32 *lpNumberOfBytesRead, <br />
Int32);
Here's a function that returns text from a file:
String *GetFileTextWithImport(String *fileName){<br />
FileStream *fs=new FileStream(fileName,FileMode::Open);<br />
HandleRef hRef=HandleRef(fs,fs->Handle);<br />
StringBuilder *sbText=new StringBuilder(fs->Length);<br />
UInt32 uiToRead=0;<br />
ReadFileNative(hRef.Handle,sbText,fs->Length,&uiToRead,0);<br />
fs->Dispose();<br />
return sbText->ToString();<br />
}
Second Way:
just call ReadFile without importing
String *GetFileText(String *fileName){<br />
FileStream *fs=new FileStream(fileName,FileMode::Open);<br />
HandleRef hRef=HandleRef(fs,fs->Handle);<br />
IntPtr ptrText=Marshal::AllocHGlobal(fs->Length);<br />
DWORD uiToRead=fs->Length, uiRead=0;<br />
ReadFile((HANDLE)hRef.Handle,ptrText.ToPointer(),uiToRead,&uiRead,NULL);<br />
String *strRet=Marshal::PtrToStringAnsi(ptrText);<br />
Marshal::FreeHGlobal(ptrText);<br />
fs->Dispose();<br />
return strRet;
P.S. By the way, why not use the System.IO.StreamReader?
|
|
|
|
|
thanx, _Ael
in my case i can't use StreamReader b'cos , I want Asyncronous function call. I am using ReadFile for RS232 port reading.
If we can use StreamReader or other managed call for asyncronous calls, then please let me know . how can i do the same.
|
|
|
|
|
If we can use StreamReader or other managed call for asyncronous calls, then please let me know . how can i do the same.
FileStream::BeginRead
FileStream::EndRead
|
|
|
|
|
I've a Jsp Page that sends the username and password for validation to a java bean.
Can u plz help me in writing the code for java bean to validate the login info since i'm new to java platform:
reply to sweetselvi_s@yahoo.co.in
reply me as ealry as p'ble thro the mail id sweeetselvi_s@yahoo.co.in
|
|
|
|
|
You need to compare the username and password (or a hash of the password) against a previously stored username and password (or password hash). The validation code should probably return only a simple boolean value; true for accepted, false for refused.
But this isn't really an appropriate discussion board (or even an appropriate site) for discussing Java-specific things. Search on Google, and browse through some java sites. I guarantee you that a thousand people have already written exactly what you are describing, and probably a few hundred have explained the entire process on the web. I'm sure you can find an explanation if you look for a while.
|
|
|
|
|
i'm working on Binary Search trees and i'm having trouble on making it run...there was no error on compiling it actually, but when i try to run it...it sez about a linker error? what does that mean?
|
|
|
|
|
I have a C++ project called the VCF[^]. I have been thinking that a port of it using Managed C++ and .Net would be extremely useful. Would others here think likewise? If so would anyone be interested in helping out with this?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Yes, I've been thinking of using managed and unmanaged c++ in the same project together.
But I'm not sure how it is effective and useful. I haven't tried yet.
I'm looking for it soon. Maybe next project!
I would like to recommend one book.
"Extending MFC Applications with the .NET Framework" "by Tom Archer, Nishant Sivakumar"
"Addison Wesley"
quite helpful I think.
Good luck and big progress!
|
|
|
|
|
I am making a game for my computer programming class. So far, I have it to where the user can either type in "up", "down", "left" or "right". Because it takes so long to type these in, it is hard to move across the map. I was wondering if there was some sort of code that would get input directly from a button (ie the user presses "w" and I would make it so the user moves up one space). Thanks.
|
|
|
|
|
Did you try
_getch?
Regards,
-Ron
Sincerely,
-Ron
|
|
|
|
|
Hi, does anyone know any code editor that is suitable for learning assembly programming language, C and C++ programming language? Because i'm busy with my task at workplace, i can't go check on the market. anybody know the url to download the editor for free to use on learning purpose only?
|
|
|
|
|
Try http://www.textpad.com.
This editor allows you to customize the syntax coloring for different types of documents. I have been using it for programming PLC's in a proprietary Assembly-like language. The syntax coloring is great. There is also synchronized scrolling, macro's, regex's and a lot of other nice stuff. But of course, it is just an editor.
Regards - PSMKB1110
vita non est vivere sed valere vita est
|
|
|
|
|
Thank you very much, it looks pretty good.
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
What is the syntax for a method that returns a pointer to a managed array? I don't know where to put the stars...
|
|
|
|
|
I have been trying for about a month now to get my computer to support php. The problem is, I downloaded the crap from php.net, and when I run the set-up in DOS, it con't find most the stuff!
..................
|
|
|
|