#include <iostream> #include <uuid/uuid.h> #include <time.h> #include <unistd.h> #include <fstream> #include <istream> #include <ostream> #include <sstream> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { readFile8(); return 0; } void readFile8() { FILE *fp=fopen("log2.txt","r"); if(!fp) { printf("Create or open log2.txt failed!\n"); } char *uuidValue=(char*)malloc(40); size_t len=40; int num=0; while((getline(&uuidValue,&len,fp))!=-1) { printf("Num=%d,value=%s\n",num++,uuidValue); } fclose(fp); free(uuidValue); printf("Finished!\n\n"); } void writeFile7()
The effect as below snapshot.
Similar Posts:
- C++ write and read file via fstream in ios::out,ios::in,ios::app mode
- [Solved] Run-Time Check Failure #2 – Stack around the variable ‘a’ was corrupted
- invalid conversion from ‘void* (*)()’ to ‘void* (*)(void*)’
- C++ Error: Run-Time Check Failure #2 – Stack around the variable ‘cc’ was corrupted.
- The solution of “no matching function for call to…” in G + + compilation
- [Solved] C Programmer Error: double free or corruption (fasttop)
- [Solved] C++ get file size via ifstream and set mode as ios::ate
- How to solve Visual Studio error C4996
- Using SQLite to show undefined reference to ` SQLite3_ open’…
- C++ Project Error: C Undefined symbols for architecture x86_64: “char_width(char)”