deleted lines 5 and 9 because they serve no purpose and are probably screwing up the rest of your program.
Also, make sure you close both files before leaving that if clause.
deleted lines 5 and 9 because they serve no purpose and are probably screwing up the rest of your program.
Also, make sure you close both files before leaving that if clause.
I put it at the top of the *.h file
#pragma once
#include "Window2.h"
Did you add #include "Window2.h"
at the top of that file? I just compiled the code you posted and did not get any erors or warnings, and it ran just as I expected it to run.
I didn't realize there was that option -- I normally just remove the file from the project.
>>PS: I'm an ameture programmer. I'm not in college. I'm a high school seinor. I was just asking for help, not for you guys to do it for me.
If you want to learn to program then you have to learn to read, comprehend, and follow instructions. Both Narue and I have offered to help you but you have so far failed to provide the information we need to do so.
You did not make the changes I suggested. You forgot to add the ^ in the declaration of W2. Window2^ W2;
Just like c++ and C W2 has to be a pointer. Pointers in CLI are designated with ^ instead of *.
The third line should be W2->Show(); -- needs the parentheses.
managed c++ does not use new -- it uses gcnew. And you have to make W2 a pointer. The braces are unnecessary.
Window2^ W2;
W2 = gcnew Window2;
W2->Show;
You probably got no responses because no one knows what the hell you are talking about. Don't assume everyone knows what those acronyms mean, such as KPO, "HCL BPO" and "B.Tech. in Computer Science".
You should also mention what country you live in. This is the net and for all we know you might be living at the North Pole with Santa Clause.
You are allocating memory for the structure, but not for name element of that structure and that's why fscanf() doesn't work.
when line 25 returns NULL then line 26 is going to cause a lot of grief. You need an if statement between those two lines.
if( (start = strchr(line,'$')) != NULL)
{
// blabla
}
1. name must be defined in maiun(). Since the constructor of MyClass expects a std::satring then declare std::string name in main()
2. Remove the parentheses in the macro
3. There is no point in using that macro other than as an educational tool.
Your program can create a file anywhere it wiches as long as it has the permissions needed to do that. You can't create a file in a directory where you don't have write permissions.
Or are you trying to ask if you can put the path in a file and read the path from that file. For example, if you have file named ./path that contains "/User/Joey/Desktop/". The answer is again yes, you can easily do that. Just read the file into a variable the use that variable in the call to fopen()
at line 4, Found and Temp both point to the same string. Therefore the parameters to strstr() on line 6 are the same string. And line 9 will do nothing because Temp - Found is the same as Dest - Dest, which is 0.
The only want to close MessageBox is to hit its Ok button.
Look in the purple ribbon near the top of the screen. Clikc the link CONTROL PANEL
use a debugger and you should be able to step into the interrupt function. I don't know what code it executes but at some point it will have to access the keyboard device driver. You can install your own int16h interrupt handler but that is not advisable.
int 16h is keyboard interface. Put the desired function in ah and issue int 16h interrupt. See this link for one of many links that describe the services. When ah is 0 (as in xor ax,ax) then int16h will wait for keystroke.
When you start the program it sets the current working dirfectory to the folder which clontains the source files. So if you put that file in the debug folder then you copied it to the wrong folder. Put the file in the same folder as the *.c and *.cpp files.
Since a shell is a user-interface to the os I suppose there may be versions of *nix which run without a shell and without human interface. I think those would be pretty rare cases.
Not that I am aware of. If you want to add it as a parameter to a function then just do it yourself, such as foo("MyFunction");
Some compiler IDEs such as Microsoft can provide that information, but C and C++ lcnaugages know nothing about function names -- only addresses.
>>When is not going to be available a shell?
Some embedded systems don't have a shell. I have not used all operatin gsystems so I suppose there could be a few others out there too that don't have shells. MS-Windows and *nix will always have one available.
Instead of testing system(NULL) why not simply test system(myprog)? Why bother calling system() twice when once will do.
I have never found a need to copy the vtable in any of my c++ programs. I normally use Microsoft compilers and have never encountered a vtable problem with them. If you use a compiler that has such a problem then get yourself a different compiler.
>>ifp=fopen("in.txt","r");
That is opening the file in text mode while fread() expects binary mode. Suggest you replace fread() with fgets() if you want to keep text mode.
>>fread(text[0],sizeof(char*),1,ifp);
sizeof(char*) is always the sjze of a pointer, which on MS-Windows and *nix 32-bit compilers is 4. And that's why fread() is only reading 4 characters.
Another forum I visited merged multiple consecutive posts by the same person.
Instead of someone posting an example you should post what you have tried.
You can use / in both MS-Windows and *nix. C:/foo/bar.dat
If you still want to use \, then the only time you need \\ is in string literals which are surrounded by quotes. Paths read from a file or returned by some other function do not need \\.
Is that function a member of a class? If yes, then in the *.cpp file you have to identify the namespace in which it appears as well as the class name, something like this:
#include "contacts.h"
namespace MyNamespace // or whatever its called in the *.h file
{
void MyClass::loadCustomerDetails()
{
// blabla
}
}
>>lblName->Click += gcnew System
You do NOT use += in that line, just =.
If your program is calling OpenFileDialog() then you need to set the RestoreDirectory property to TRUE so that it does not change the current working directory on you.
you are using the same fstream object to do both reading and writing. That is ok, but you have to call seekg() between the two in order to reset the file pointer back to the beginning of the int that was written.
[edit]Or use ifstream and ofstream as ^^^ suggested.
You can not open the same file twice. Use just one FILE* pointer and open it for both reading and writing if you need to.
What compiler are you using? VC++ 2010 does not allow you to declare variables like you did on line 58 because iFS must be a constant. The new c++ standards will probably allow it, but for now it's not permitted except as a compiler extension to the current standards. That error is most likely what's causing the problems you described.
Post the entire program so that we can compile it.
Yes, you can create the program, but VC++ can not compile for platforms other than MS-Windows and a few embedded devices. IMO if you need the program to be compatible on both MS_Windows and *nix then use Code::Blocks with MinGW on MS-Windows and Code::Blocks with g++ on *nix. If you want to write a GUI program then use QT for cross-paltform.
you probably didn't include <fstream> and add using std::ofstream;
>>I am not really quite following you about posting the code between code tags. Can you please tell me exactly what I need to do?
[code] // <<< this is called a code tag // put all your code here
[/code] // <<< this terminates the code tags
>>void main ()
main() always returns an integer -- its never void even if your compiler allows it. Many compilers won't let you declare void main(). Get into the habbit of writing programs correctly and always declare it as int main()
or int main(int argc, char* argv[])
I could offer some other suggestions to fix your code but won't because you failed to post the code between code tags.
what is %2 supposed to mean? Or do you just want to print %2 on the console screen? If yes, then just use int 21 instructions to do that, assuming you are using Intel or compatible processor.
>>Anyways, if it outputs correctly in the console, shouldn't there be a way to make that output into a new text file instead of the console?
Your program is trying to read the data in one function and write it back out to another file in another function. The only way that can be done like that is to save all the data in memory when it is read.
The alternative way to do it is to write it back out to a file in the same loop that reads it. If you do that then neither outputData() nor the vector is not needed.
The loop on line 55 is not saving the data in memory. It is just simply overwiring all the data that was read during the previous iteration of that loop with new data. If you want to do anything useful with any of that data you need to save it into a vector of structures, where a structure contains all the data for one line of the file. Once you have that finished you can easily store the contents of the vector to a file in another function.
structure customer
{
string name;
string address;
string city;
string state;
string zip;
};
vecotor<customer> custdata;
... <snip>
customer cust;
// note that eof() is not needed here.
while(getline(inData, cust.name, '^'))
{
getline(inData, cust.address, '^');
getline(inData, cust.city, '^');
getline(inData, cust.state, '^');
getline(inData, cust.zip);
custdata.push_back(cust);
}
line 46 does not require use of new because bar is not a pointer. This is all that line 46 needs to do. bar b(fc);
Ignore the vector part and concentrate on how it recognizes a new sub directory and makes a recursive call to process the files in it. In C language I would replace that vector with a linked list if you need to keep the list of all files in memory for some reason.
Check this thread out -- it was written in c++ but could be easily ported to C. If you read the code you will discover that it uses recursion to crawl though all sub directories.
You have to tell stringstream that the string is in hex fomat ss >> std::hex >> output;
And include <iomanip>