Bus error in simple C program -


i have following simple program. , running "program file.txt" command line , getting "bus error" no output. don't know i'm doing wrong here.

#include<stdio.h>  int main(char *arg[]) {      file *file = fopen(arg[0], "r");      if (file == null) {         printf("cannot open file.\n");         exit(1);     }      return 1; } 

could print out value of arg[0], suppose type of main

int main(int argc, char* argv[]) 

and argv[0] name of process, argv[1] first argument.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -