• 11
• 9
• 10
• 9
• 11

Dose anyone know this?

This topic is 4710 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

How do you(I) load(open)(run) files in C?

Share on other sites
Look up fopen and fprintf, I think.

Share on other sites
To open files and read the contents, use fopen.
ex:
FILE* fp = fopen("hello.txt", "r");assert(fp != null);/* do stuff with the file */fclose(fp);

To run programs that is platform depedent. Usually something along the the lines of system("notepad.exe") will work.

Share on other sites
I need to run a BATCH file (.bat) and none of the things yal' gave me worked.

Share on other sites
Quote:
 Original post by t5hoo6I need to run a BATCH file (.bat) and none of the things yal' gave me worked.

Umm in Unix/Linux? You could try using system to execute it, but not sure how that's done on that platform. Give it a look though! BTW, I though .BAT files were something doe Dos/Windows? I might be mistaken though, so excuse my lack of knowledge in the *nix area [wink]

Share on other sites
How about how do you clear the screen my compiler cannot use CLS?

Share on other sites
Quote:
 Original post by t5hoo6How about how do you clear the screen my compiler cannot use CLS?

system("clear"); is the *nix version IIRC.

Share on other sites
Using system(); is just all around bad IMHO.

Use either the ncurses or boost libraries.

Share on other sites
Or implement it all by yourself, using ASCII escape sequences... ;)

Cheers,
Drag0n