Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to open .ttcn file using C file open functions?
    primarykey
    data
    text
    <p>I am working on TTCN-3 (Testing and Test Control Notation) scripting language. I wanted to prepare on guideline checker for this code files. <p>For that I want to read lines of TTCN-3 script file( some thing like file.ttcn ) one by one into a buffer. But for me fopen / sopen / open / fgetc / fscanf are not able to work properly and are not reading the file correctly. It is giving NULL. Is there any way I can read characters of it into a buffer. I think C cannot read files with more than three extension characters (like .ttcn). Forgive me if my assumption is wrong.</p> <p>My Environment is Turbo C on windows. <p><strong>Edit</strong>: <p>Yes I checked those errors also but they are giving unknown error for read() and no such file or directory exists. <p>My code is as follows <p> </p> <pre><code>#include &lt;errno.h&gt; #include &lt;io.h&gt; #include &lt;fcntl.h&gt; #include &lt;sys\stat.h&gt; #include &lt;process.h&gt; #include &lt;share.h&gt; #include &lt;stdio.h&gt; int main(void) { int handle; int status; int i=0; char ch; FILE *fp; char *buffer; char *buf; clrscr(); handle = sopen("c:\\tc\\bin\\hi.ttcn", O_BINARY, SH_DENYNONE, S_IREAD); </code></pre> <p>/<em>here even I used O_TEXT and others</em>/</p> <pre><code> if (!handle) { printf("sopen failed\n"); // exit(1); } printf("\nObtained string %s @",buf); close(handle); fp=fopen("c:\\tc\\bin\\hi.ttcn","r"); \\sorry for the old version of one slash if(fp==NULL) \\I was doing it with argv[1] for opening { \\user given file name printf("\nCannot open file"); } ch=fgetc(fp); i=0; while(i&lt;10) { printf("\ncharacter is %c %d",ch,ch); i++; //Here I wanted to take characters into ch=fgetc(fp); //buffer } getch(); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload