|
If I include it within <> it only search the include directory, isn't it?
I appreciate your help all the time...
Eranga
|
|
|
|
|
#include "" tells the compiler to search the file in the current project directory first
#include <> means to search the file in the compiler headers directory. commonly, under Windows, it is somewhere in Program Files/.
|
|
|
|
|
#include<...> means to search first tru a list of 'Standard' directories. You can edit or change that list through your Project/Settings options. At the time of writing the standard, the fear was that someone had his own working library and header file like say 'stdio.h', which at that time could have crashed some one's code when they took the standard on board. Hence the '<...>' is for 'standard' files.
NB, from an Old Hand: Use <...> ONLY for standard files , and "..." for ALL your own includes as a matter of form!
It eill save you heartache over time, untill you gain full understanding of how your compiler searches include directories.
Bram van Kampen
|
|
|
|
|
Why d'you say this to ME ?
|
|
|
|
|
|
#include<...> means to search first tru a list of 'Standard' directories. You can edit or change that list through your Project/Settings options. At the time of writing the standard, the fear was that someone had his own working library and header file like say 'stdio.h', which at that time could have crashed some one's code when they took the standard on board. Hence the '<...>' is for 'standard' files.
NB, from an Old Hand: Use <...> ONLY for standard files , and "..." for ALL your own includes as a matter of form!
It eill save you heartache over time, untill you gain full understanding of how your compiler searches include directories.
Bram van Kampen
|
|
|
|
|
|
Does visible style is true ?
|
|
|
|
|
|
Did you try with to add controls to form with code not visual,did you have same problem?
|
|
|
|
|
Not yet.
It's ok in vc6.
I've uninstalled vs2008 just now.
I'll try vs2005 tomorrow.
Thanks all the same.
|
|
|
|
|
I hope you didn't uninstall VS 2008 just because your
controls didn't show up
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Another reason is that it is bit slow and lack of a class wizard at least in the beta version.
I've tried to report the control problem to ms.
|
|
|
|
|
Does anyone know how to retrieve a Hard Disk Serial number from the Hardware.(i.e. one that corresponds(or is supposed to do so) with the label on the Device. (or, for that matter, any other number that identifies a machine.) I am trying to put together some licencing software. Is there any code about I can readlly use free in a small commercial app, whitout delving into too many details.
Happy New Year to All
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Does anyone know how to retrieve a Hard Disk Serial number
Use Win32_PhysicalMedia class of WMI to get the hard disk serial number.
|
|
|
|
|
Naveen wrote: Use Win32_PhysicalMedia class of WMI to get the hard disk serial number.
Thanx
Do you have a brief example
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Do you have a brief example
Sorry i dont have. but i am sure you will find some if you google or check Microsfot script center[^]. Check this [^]link also( its in vb )
|
|
|
|
|
|
dear all
how to read a data file from harddisk to my program? thanks
Li Zhiyuan
8/01/2008
|
|
|
|
|
Do u mean like fscanf() or fread().
|
|
|
|
|
i mean i had a data file in my harddisk, but i should use it in my program...how to read or load the file? thanks.
do u have any code which read one file to program? can i work as a reference. thanks
Li Zhiyuan
5/10/2006
modified on Monday, January 07, 2008 10:01:39 PM
|
|
|
|
|
#include <fstream>
std::ifstream file("C:\\Temp\\hello.txt");
Maxwell Chen
|
|
|
|
|
Without further info I do not realy understand your problem, but, the general procedure is:
Step 1. You should know the fully qualified name of the file you want to read i.e.: CString MyFile="C:\MyDirectory\MyData\DataFile.ext". If you type that as a string in your code(bad Idea, but not your immediate problem) you should type all backslashes double. i.e.:CString MyFile="C:\\MyDirectory\\MyData\\DataFile.ext".
Step 2;
You Open the file, and get a File Handle:
FILE* F =fopen(MyFile,"rb"); The "rb" means that you want to open the file for binary reading, (as opposed to Text Reading, which should be opened for reading with just "r")
Step 3: You find out how big the file is. You move the File Pointer to the End of the File, and ask where it is.
size_t CurPos=ftell(F);// Record the File Pointer
fseek(F,0,SEEK_END)
size_t FileSize=ftell(F);
fseek(F,CurPos,SEEK_SET);// Returns the FilePointer to where it was
Step 4:
Allocate a buffer to hold the File Contents
char* Buf=(char*)malloc(FileSize);
Step 5:
Ensure that there was enough free memory left to Allocate the Buffer
if(Buf==NULL) return ERR_OUT_OF_MEM;
Step 6:
Read the File into the Buffer
fread(Buf,FileSize,sizeof(char),F);
step 7:
Close the File. This is most important, Noone Else can work with the file while you have it open, Even yourself cannot open it a second time.
Step 8:
The contents of your file is now in Buf. Do with it as you like.
Step 9:
When You're done with it, you should 'free' Buf. Unlike say VB, C++ has NO garbage collection service. It is up to you to get rid of memory you no longer need.
Bram van Kampen
|
|
|
|
|
do you have any source code to read data from harddisk and print it on the screen? thanks a lot.
i am reading one book, it is still blur, thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
Did you use of CFile class?
|
|
|
|